views:

65

answers:

1

I display the below in the Inner Html and assign the value to the mode:

resultsdata1.InnerHtml += "<tr><td><a href=""Results.aspx?mode=2&key=" & dr("UID") & """>" & dr("PPS") & "</a></td><td>" & dr......

1)How do I preserve the mode so that I can test for mode value in page load event?

2)How do I find out which the key has been clicked?

3)How do I preserve the key so that I can test for mode value in page load event?

I do not cross to another page, but stay on the same .aspx form.

I already do the below:

ViewState.Add("key", "value") 'store value in viewstate

ViewState.Add("mode", "value") 'store value in viewstate

and subsequently:

        If ViewState("key") IsNot Nothing Then
            LearnerPPS = CInt(ViewState("key"))
        End If

        If ViewState("mode") IsNot Nothing Then
            PanelNo = CInt(ViewState("mode"))
        End If

But for some reason both the ViewState.Item("key") and ViewState.Item("mode") are Nothing!

+2  A: 

From what I can gather, you have a link (at least one) on the page Results.aspx. Within that link you're passing the mode and key values back to the same page through the query string within the link. If this is correct, then your code is looking in the wrong place for the passed values. You should be looking in QueryString:

If Request.QueryString("key") IsNot Nothing Then
    LearnerPPS = CInt(Request.QueryString("key"))
End If

If Request.QueryString("mode") IsNot Nothing Then
    PanelNo = CInt(Request.QueryString("mode"))        
End If
CAbbott
Thank you very much CAbbott
Greg