Solution:
<asp:TemplateField SortExpression="Exp" HeaderText="text">
<ItemTemplate>
<asp:HyperLink runat="server" Text='<%# Eval("Name") %>' NavigateUrl='<%# string.Format("~/SubSite/Default.aspx?reg={0}&Source={1}", Eval("Id"), Request.Url) %>' />
</ItemTemplate>
</asp:TemplateField>
Instead of:
<asp:HyperLinkField DataTextField="Name" DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~\SubSite\Default.aspx?reg={0}"
HeaderText="text" SortExpression="Exp" />
Greetings
I have a GridView containing some HyperLinkFields. What I am trying to do is to add the "&Source" query in the DataNavigateUrlFormatString
when I click one of the hyperlinks.
When I do it like this: DataNavigateUrlFormatString="~\SubSite\Default.aspx?Query={0}&Source=<% Request.Url.AbsolutePath%>"
The URL I get is this: http://www.website.com/SubSite/Default.aspx?Query=702&Source=<%Request.Url.AbsolutePath%>
How do I make sure it writes the URL that I try to get through <% Request.Url.AbsolutePath%>
?