This should be simple and I do have this working on another application - the only difference is that I am not setting my querystring in the ascx page which is what I am trying to do with this. Is it even possible to set a redirect that sets a querystring value in an ascx page?
I have my navigation in an ascx page and created a reference for it in my master page. I tried to include the navigation directly in the master page but had the same issue.
Basically I am using linkbuttons in my navigation; the link buttons have click events in the ascx code behind like so:
Protected Sub lnkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkButton1.Click
Response.Redirect("/subdirectoryName/page.aspx?ID=" & varName.ToString)
End Sub
Then on my aspx page in the code behind:
Private Function GetID() As Integer
Dim SomeID As String
Dim ThisID As Integer
SomeID = Request.QueryString("SomeID ")
If Not SomeID = "" Then
Try
ThisID = Integer.Parse(SomeID)
Catch ex As Exception
Throw New Exception("Invalid ID")
End Try
Else
ThisID = 0
End IF
Then I just call this function in the pageLoad Event. Unless I hard code a value into my function, I get my exception every time. If I look in the address bar of IE I can visibly see that the querystring is there. I asked a coworker if the queryString is not accessible when it's set in an ascx or master page and he said that it shouldn't matter where it's coming from.
I have my navigation in an ascx page and created a reference for it in my master page. I tried to include the navigation directly in the master page but had the same issue.
Basically I am using linkbuttons in my navigation; the link buttons have click events in the ascx code behind like so:
Protected Sub lnkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkButton1.Click
Response.Redirect("/subdirectoryName/page.aspx?ID=" & varName.ToString)
End Sub
Then on my aspx page in the code behind:
Private Function GetID() As Integer
Dim SomeID As String
Dim ThisID As Integer
SomeID = Request.QueryString("SomeID ")
If Not SomeID = "" Then
Try
ThisID = Integer.Parse(SomeID)
Catch ex As Exception
Throw New Exception("Invalid ID")
End Try
Else
ThisID = 0
End IF
Then I just call this function in the pageLoad Event. Unless I hard code a value into my function, I get my exception every time. If I look in the address bar of IE I can visibly see that the querystring is there. I asked a coworker if the queryString is not accessible when it's set in an ascx or master page and he said that it shouldn't matter where it's coming from.