Thursday, March 29, 2012

Passing values between forms

(Type your message here)
Hi
I'm new to asp.net and I need some help
I have three forms with some textboxes.I want to pass the values of the textboxes of form1 and form2 to the third form
For this I'm using in the first form
System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
also a get function for returning the values of textbox
In the second form
rp1 = CType(context.Current.Handler, firstform)
RegisterHiddenField("txtpjcode", Request("txtpjcode"))
similarly for the second form
But When I run this I can't retrive any values of previous forms

----------
From: Mani P.S

--------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>vrL66fQqLUe3kVkG/raHIA==</Id>Hi,

see this in MSDN
http://msdn.microsoft.com/library/d...bformspages.asp

HTH
Regards

Joyjit

"Mani P.S via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:u1OdS1pNFHA.1732@.TK2MSFTNGP14.phx.gbl...
> (Type your message here)
> Hi
> I'm new to asp.net and I need some help
> I have three forms with some textboxes.I want to pass the values of the
textboxes of form1 and form2 to the third form
> For this I'm using in the first form
> System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
> also a get function for returning the values of textbox
> In the second form
> rp1 = CType(context.Current.Handler, firstform)
> RegisterHiddenField("txtpjcode", Request("txtpjcode"))
> similarly for the second form
> But When I run this I can't retrive any values of previous forms
> ----------
> From: Mani P.S
> --------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
> <Id>vrL66fQqLUe3kVkG/raHIA==</Id
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Mani P.S via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:u1OdS1pNFHA.1732@.TK2MSFTNGP14.phx.gbl...
> (Type your message here)
> Hi
> I'm new to asp.net and I need some help
> I have three forms with some textboxes.I want to pass the values of the
> textboxes of form1 and form2 to the third form
> For this I'm using in the first form
> System.Web.HttpContext.Current.Server.Transfer("secondform.aspx")
> also a get function for returning the values of textbox
> In the second form
> rp1 = CType(context.Current.Handler, firstform)
> RegisterHiddenField("txtpjcode", Request("txtpjcode"))
> similarly for the second form
> But When I run this I can't retrive any values of previous forms
> ----------
> From: Mani P.S
> --------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
> <Id>vrL66fQqLUe3kVkG/raHIA==</Id

0 comments:

Post a Comment