使用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