|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
specifying a query string in an href dynamically<asp:DataList ... > <ItemTemplate ... > <table> <tr> <td image src='... <%# DataBinder.Eval(Container.DataItem, "IncidentID") %>' </td> <a runat="server" href="somepage.aspx">some text</a> </tr> </table> </ItemTemplate> </asp:DataList> The image is rendered via a custom HttpHandler. What I want is to put in a query string following the page reference in the href, something like href="somepage.aspx?IncidentID=<somevalue>" where <somevalue> would be computed. I tried putting <%#DataBinder.Eval(Container.DataItem, "IncidentID")%> inside the href, following the "IncidentID=", but it did not get evaluated. I assume that there must be a very simple way of doing this (or its equivalent). Can someone clue me in? Hi Robert,
I believe you can do it in this way: <asp:hyperlink NavigateURL='<%# "/somepage.aspx?IncidentID="+ DataBinder.Eval( Container.DataItem, "IncidentID" )%>' Text='<%# DataBinder.Eval( Container.DataItem,"Some text" )%>' runat="server"/> Hope that helps Henry Robert Rotstein wrote: Show quoteHide quote > I have a control that looks something like this: > > <asp:DataList ... > > <ItemTemplate ... > > <table> > <tr> > <td image src='... <%# DataBinder.Eval(Container.DataItem, > "IncidentID") %>' </td> > <a runat="server" href="somepage.aspx">some text</a> > </tr> > </table> > </ItemTemplate> > </asp:DataList> > > The image is rendered via a custom HttpHandler. What I want is to put > in a query string following the page reference in the href, something like > > href="somepage.aspx?IncidentID=<somevalue>" > > where <somevalue> would be computed. I tried putting > <%#DataBinder.Eval(Container.DataItem, "IncidentID")%> inside the href, > following the "IncidentID=", but it did not get evaluated. I assume > that there must be a very simple way of doing this (or its equivalent). > Can someone clue me in?
Other interesting topics
How to add a small HTML table under a row of a GridView
Application["TotalPlayings"]++ doesn't work Source Control Products??? Downloading file from database Some questions about masterpages. Problem Running ASP.NET/ASP App Under VS 2005 how load one frame before another in aspx page The server tag is not well formed Disabling Link Button Column in Datagrid Connecting to Active Directory through ASP.NET Web form |
|||||||||||||||||||||||