thomashospital
asked on
Passing an ID to a request query string using an asp.net Hyperlink object
I have a repeater that links a series of news stories from a database. I am trying to pass the ID field through a Hyperlink Object:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# string.Format("News_Detail s.aspx?ID= {0}", Eval("PKID") ) %>' Text='<%# DataBinder.Eval(Container. DataItem," Headline") %>' />
</strong>
The problem I am having is I am not getting a value from the second page in the code behind:
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim NewsID As String
NewsID = Page.Request.QueryString(" News_Detai ls.aspx?ID =" & ID)
If Request.QueryString("News_ Details.as px?ID=" & ID) <> Nothing Then
MsgBox(NewsID.ToString)
End If
End Sub
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# string.Format("News_Detail
</strong>
The problem I am having is I am not getting a value from the second page in the code behind:
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim NewsID As String
NewsID = Page.Request.QueryString("
If Request.QueryString("News_
MsgBox(NewsID.ToString)
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
check the below code
<a title='<%# Eval("Title") %>' href='ShowNews.aspx?Id=<%#