Link to home
Start Free TrialLog in
Avatar of M.L. Martin
M.L. MartinFlag for United States of America

asked on

Using hyperlink control within a sqldatasource datalist control to pass a querystring value coming from the sqldatasource

I am trying to use a hyperlink control within a data list. The problem I have is I do not know the correct syntax to pass the data value coming from the SQLDataSource. Here is my scenario:



I have a SQLDataSource. It is bringing back multiple values including a field called eid which is an int value.  I need to place a hyper within the datalist and go to a page called favorites. I need to pass the eid value coming back from the SQLDataSource to the favorite.aspx page. I did a databind on the hyperlink and I am able to use the hyperlink to go to a page but the databinding appears to be for the text value only. Not to pass the eid 'field' value in QueryString to the favorites.aspx page, which is what I need to do. I tried to add the eid value by using this code, ?eid={0} but it does not work. Here is the code I have so far:

<asp:HyperLink ID="HyperLink1" runat="server" ForeColor="White" Text='<%# Eval("eid") %>' NavigateUrl="~/favorites_addexercise.aspx?eid={0}"></asp:HyperLink>
ASKER CERTIFIED SOLUTION
Avatar of Stephan
Stephan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial