Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capture a prior form value
Message
From
14/05/2008 13:03:27
 
 
To
14/05/2008 12:30:56
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01317012
Message ID:
01317068
Views:
9
See my inline answers. I am no expert. I am maintaining/re-writing a web app that was developed for us off-shore. We are still on Framework ver 1.4.
That said, see my in-line comments.

>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.

Our app uses session variables, but we have a very complicated data model (up to 47 tables for a doc and requirement that the doc be saved in a transaction), so we need to maintain state from page to page. We actually store the entire dataset of the doc in Session.


>
>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.

Like this:
Session("selectedrecord") = GridView1.SelectedValue
Retrieve:
CurrentRecord = CInt(Session("selectedrecord"))
>And by the way, thanks for your help.

You're welcome!


>- 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
Reply
Map
View

Click here to load this message in the networking platform