OK, with this code in the first page.
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Session("selectedrecord") = GridView1.SelectedValue.ToString
Response.Redirect("edituser.aspx")
End Sub
and this code in page2 load
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim CurrentRecord As Int32
CurrentRecord = Session("selectedrecord")
Response.Write(CurrentRecord)
End Sub
I seem to get what I want. (the user_id of the selected record) My further question would be . . .
I remember discussions on ASP in general that suggest session variables are to be avoided if possible due to their loading on the server and other reasons. Just as public variables are somewhat frowned upon in VFP. So, is there a better way? and Does the above code look right to you? I have user_id in the DataKeyNames of the Gridview1.
Also, would there be a way to retrieve the value in its original form (integer) rather than converting it from a string? The intellisense doesn't seem to have ToInteger as an option.
And by the way, thanks for your help.
- Don
>In the first page:
>
>
Session("MyValueName") = myvalue
>
>In load of the second page:
>
>
myvalue = DirectCast(Session("MyValueName"), myvaluetype)
>
>
>
>>As a .NET total newbie, can someone tell me how to capture a value from the preceeding page control? Something like :
>>
>>myvalue = request.gridview1.value ???
>>
>>
>>And would the code properly be placed in the load event of the second page if we wanted to use the value to establish a control on the new page?
>>
>>Specifically, page1 has a grid where the user selects a record. Control is then transferred to page2 which contains a formview that displays the record details.
>>
>>
>>Thanks