Reputation: 97
Can anybody tell me how to pass a value from one web form to another web form without using a query string and session?
Upvotes: 2
Views: 6834
Reputation: 3224
With Session:
For example you login the system and your id is 123123123.
string userid = 123123123;
Session["userid"] = userid;
When you go another page/pages your session is alive when your session timeout.
<system.web>
<sessionState timeout="1250"/>
</system.web>
Upvotes: 1
Reputation: 1
depends on type and how much information you wish to transfer. for instance, if you want to transfer some variable (strings or integer values) you consider to use querystring (you can found here major information). for instance, if you want to transfer typed objects (class instance) you consider to use session (you can found here major information).
Upvotes: 0
Reputation: 89
Using PostBackURL
, ex:
PostBackUrl="~/result.aspx"
and on result.cs
(Page Load)
lblEmployeeNumber.Text = HttpContext.Current.Request.Form["txtEmployeeNumber"];
Upvotes: 2
Reputation: 38163
It seems what you're looking for is something like the flash-, view- or conversation scope in Java EE and Ruby on Rails.
For ASP.NET you could perhaps take a look at this one: Is there an equivalent of JSF @ViewScope in ASP MVC?
Upvotes: 0
Reputation: 24302
there are several ways you can pass parameters between pages.
for more detail visit followng link.
http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
Upvotes: 3
Reputation: 3328
You can pass the Values over different pages via QueryString like:
Response.Redirect("yourNextpage.aspx?identifier=DesiredValue");
On your next page you can retrieve the value like this:
Request.QueryString["identifier"];
Other Preferred way would be Server.Transer() and Postbackurl.
Refer this link for various possible ways.
Upvotes: 4
Reputation: 1737
You could use a Querystring in this case:
Page.Response.Redirect("show.aspx?id=1");
And then read it on the other end:
int id = Page.Request.QueryString["id"];
Upvotes: 2