I have a hyperlink using NavigateURL in my gridview to pass field values in my table. I was wondering if it were possible to pass other values, other than the table values, in the query string as well? Such as variables in my code behind? If so, how would one go about doing this?
You can pass several key/value pairs of strings in the URL:
hyperLnk.NavigateUrl = "~/Sub1/frmMyForm1.aspx?key1=value1&key2=value2&key3=value3"
It can be done like this:
hyperLnk.NavigateUrl = String.Format("~/Sub1/frmMyForm1.aspx?key1={0}&key2={1}&key3={2}", myStr, myInt, myDouble)
In code behind, you can retrieve the values like this:
Dim var1 as string = Request.QueryString("key1")
Dim var2 as Integer = CInt(Request.QueryString("key2"))
Dim var3 as Double = CDbl(Request.QueryString("key3"))
...