Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capture a prior form value
Message
From
14/05/2008 12:30:56
 
 
To
14/05/2008 11:54:09
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01317012
Message ID:
01317046
Views:
9
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform