使用C#,.NET,Visual Studio 2010中填充页面重定向外部URL
我有一个情况,当navigationurl应该使用步骤 1调用Web服务和动态创建的GridView控件上的超链接,用户点击传递少量值并接收需要附加到控件的导航网址的新idkey,我可以在RowDataBound事件下完成此操作,但它会对网格中的每一行进行Web服务的浪费调用。相反,我希望在用户点击链接时完成此操作?
我想到的另一个想法是在填充页面之间使用页面来重定向,但需要自动提交?任何线索在这?或更好的方式?
感谢
<asp:GridView ID="GridViewLinkedService" runat="server" AutoGenerateColumns="False" DataKeyNames = "applicationId"
DataSourceID="ObjectDataLinkedService" Height="213px" Width="897px">
<Columns>
<asp:BoundField DataField="applicationId" HeaderText="Application ID" Visible ="true"
SortExpression="applicationId">
<HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" ForeColor="White" />
<ItemStyle Width="10px" />
</asp:BoundField>
<asp:BoundField DataField="referenceNumber" HeaderText="Reference Number"
SortExpression="referenceNumber" >
<HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" ForeColor="White" />
<ItemStyle Width="30px" />
</asp:BoundField>
<asp:BoundField DataField="applicationName" HeaderText="Application Name"
SortExpression="applicationName" >
<HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True" Font-Names="Verdana" Font-Size="Small" ForeColor="White"/>
</asp:BoundField>
<asp:BoundField DataField="address" HeaderText="Address"
SortExpression="address" >
<HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True" Font-Names="Verdana" Font-Size="Small" ForeColor="White" />
</asp:BoundField>
</Columns>
Hyperlink column is added in the Pageload
HyperLinkField LinksBoundField = new HyperLinkField();
string[] dataNavigateUrlFields = {"link"};
LinksBoundField.DataTextField = "link";
LinksBoundField.DataNavigateUrlFields = dataNavigateUrlFields;
**LinksBoundField.NavigateUrl; //call webservice(send appid and refno) and append newtoken to url (reieved from datasource link)**
LinksBoundField.DataNavigateUrlFormatString = "http://" + Helper.IP + "/" + Helper.SiteName + "/" + Helper.ThirdPartyAccess + "?value={0}&token=" + Session["Token"];
LinksBoundField.HeaderText = "Link";
LinksBoundField.Target = "_blank";
GridViewLinkedService.Columns.Add(LinksBoundField);
GridViewLinkedService.RowDataBound += new GridViewRowEventHandler(grdView_RowDataBound);
什么是C#.net 10? – Polity 2012-02-21 13:37:10
@Polity大概意思是视觉工作室2010 – Aristos 2012-02-21 13:50:23
@Polity是VS 2010 – Gauls 2012-02-21 13:58:03