Wednesday, March 21, 2012

Passing varuiables to on form to another

I am having trouble passing variables from on form to another. .aspx. I am using a GridView to display the table. The user inputs the LastName they want to look up. Then I want to send that variable for LastName to another form site so they can edit those entities. Oh... all confused!

Try looking into the session object and viewstate.

This works... But

*Test.aspx*

Sub edit(ByVal SenderAsObject,ByVal EAs EventArgs)

Response.Redirect("Default.aspx?name=" & System.Web.HttpUtility.UrlEncode(LName.Text))

EndSub

*Default.aspx*

Sub Page_Load(ByVal SenderAsObject,ByVal EAs EventArgs)IfNot (Page.IsPostBack)Then

NameLabel.Text = Request.Params(

"LName")EndIfEndSub<formaction="default.aspx"runat="server">

Hi

<asp:labelid="NameLabel"runat="server"/>!

I can't get it to display. Its in the URL, but its not displaying. Then once i know i got the variable then i want to display a dataform. Thanks Nic


You should check out this webpage:http://blogs.wwwcoder.com/psantry/archive/2004/05/14/398.aspx

If that doesn't help you, maybe you could look into Request.Querystring instead of Request.Params.

Hope this helps.


Modify your code as following:

*Default.aspx*

If Not (Page.IsPostBack) Then

NameLabel.Text = Request.QueryString("name")

End If


I have written a small article relating to passing values between pages. Here is the URL:

Passing values between pages

Check if that helps

0 comments:

Post a Comment