Using c#, .net, Visual Studio 2010
I have a situation when a user clicks on Hyperlink on the gridview the navigationurl should be created on the fly using steps
1 calling webservice and passing few values and receive new idkey which needs to be attached to the navigation url of the control, i can get this done under RowDataBound event, but it will make waste calls to webservice for each row in the grid. Instead i want this to be done when the user clicks the link??
another idea i can think of is using a page in between fill page saying redirecting, but that needs to be auto submit?? any clue on this??? or better way of doing??
Thanks
<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);
deleted the datanavigation code
Changed to below url passed with grdviewLink.NavigateUrl does not get jumbled up.
Navigate.ashx file
this works very well
Thanks to Curt got the tip of using ashx file instead of aspx from here
ashx