C# .NET - pass query string to second page - Asked By sara asa on 09-Nov-13 03:42 AM

hi guys,
in first page i have this code that read id from sql server  with hyperlink

<


ItemTemplate>

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/forumpage.aspx?ID="+Eval("ID").ToString()%>'><%#Eval("title")%> </asp:HyperLink>


</ItemTemplate>
then

now in second page that is forumpage.aspx i need to read this query string so i put a label like this

<


asp:Label ID="lblreq" runat="server" Text='<%=Response.QueryString["ID"] %>'></asp:Label>

then in cb of second page i wanted to get this id but all time show me error nvarchar cant convert to int.
my question is how can i get that id in a label.text in second page because i really need it for insert button in second page.

thx.
Chris Challis replied to sara asa on 11-Nov-13 08:40 AM
In the codebehind you must be trying to assign the value of the ID to an Integer variable.

Change that variable from Integer to String.  Querystrings are, as the name suggests, strings.

You can then populate that textbox with the value of that variable.

sara asa replied to Chris Challis on 15-Nov-13 04:52 AM
HOW CAN I CHANGE?

REGARDS.