Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using asp:HyperLinkColumn Pass DB Value

Status
Not open for further replies.

IndyGill

Technical User
Jan 15, 2001
191
GB
Hi

I am pretty new to asp.net and have started building my first app. OK so I have a dataset which I populate as below. I then put the results in a datagrid. I then want to use a an asp:HyperLinkColumn which shows SvcDesc but has a value of SvcID. When the user click this link the selected rows SvcID is sent to another page via a querystring. However im unsure how to include the SvcID into the DataNavigateUrlFormatString.

I had a an attempt by doing something like but didnt work

DataNavigateUrlFormatString=&quot;details.aspx?SvpsID=<%#SvcID%>&quot;

But did not work

Dim Conn As New SqlConnection(ConfigurationSettings.AppSettings(&quot;connBSS&quot;))
Conn.Open()
Dim strSQL As String = &quot;SELECT SvcDesc, SvcID, FROM ServiceProviderServices&quot;
Dim objAdapter As New SqlDataAdapter(strSQL, Conn)
objAdapter.Fill(dsResults, &quot;Results&quot;)
Dim objDataView As New DataView(dsResults.Tables(&quot;Results&quot;))
dgResults.DataSource = dsResults
dgResults.DataBind()

Many thanks in advance
 
Here's one way... but not using DataNavigateUrlFormatString

<asp:HyperLink ID=&quot;selection&quot; Runat=&quot;server&quot; NavigateUrl='<%# &quot;WHATEVER.aspx?item_no=&quot; + DataBinder.Eval(Container.DataItem,&quot;item_no&quot;)%>'>SELECT THIS ITEM! </asp:HyperLink>
 
Try this:

datanavigateurlformatstring=&quot;Update.aspx?yourfield={0}&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top