GridView Hyperlink Field Append URL?

  • Thread starter Thread starter barkster
  • Start date Start date
B

barkster

I'm trying to create a link in my gridview that will include th
existing url parameters plus the ID of the field. I've trie
everything I can think of to get it to work but this was my lates
attempt below. I'm new to using asp.net and I'm just used t
building my own url's in php and this is just so different the wa
they go about it. I've tried about 5 different processes

<asp:HyperLinkField DataNavigateUrlFields="WONo
DataNavigateUrlFormatString="Detail.aspx?StartDate=<%
Request.QueryString("StartDate"
%>&amp;EndDate=<%
Request.QueryString("EndDate"
%>&amp;WO={0}"DataTextField="WONo
/
 
You can try TemplateField instead:

....
<Columns>
<asp:TemplateField>
<ItemTemplate>
<a href='<%# "default.aspx?StartDate=" +
Request.QueryString["StartDate"] + "&EndDate=" +
Request.QueryString["EndDate"] + "&wo=" +
DataBinder.Eval(Container.DataItem, "WONo") %>'>
<%# DataBinder.Eval(Container.DataItem, "WONo") %>
</a>
</ItemTemplate>
</asp:TemplateField>
....
</Columns>

I'm trying to create a link in my gridview that will include the
existing url parameters plus the ID of the field. I've tried
everything I can think of to get it to work but this was my latest
attempt below. I'm new to using asp.net and I'm just used to
building my own url's in php and this is just so different the way
they go about it. I've tried about 5 different processes.


<asp:HyperLinkField DataNavigateUrlFields="WONo"
DataNavigateUrlFormatString="Detail.aspx?StartDate=<%#
Request.QueryString("StartDate")
%>&amp;EndDate=<%#
Request.QueryString("EndDate")
%>&amp;WO={0}"DataTextField="WONo"
/>
 
Back
Top