ASP.net Bengali tutorial part-2 || Send page values from one page to another page in ASP.net

There are many ways you can transfer your one page values to another page either using (1) Cookies or (2) Using QueryString. In this tutori...

There are many ways you can transfer your one page values to another page either using (1) Cookies or (2) Using QueryString. In this tutorial I will discuss both of them. In my tutorial I have used visual studio 2005 and .net 2.0. You may use higher version of visual studio, but the procedure and code will remain same. This process will reduce the use of database but it also reduces data security. One have fair knowledge in web address can easily identify those data.

Send Page value using QueryString

This procedure happens on client side but it is slightly different from cookies. Here no data will be stored on client’s machine instead of that page value will be transferred from one page to another.

Step 1:

In this tutorial I have used two pages (1) Default.aspx (2) Default2.aspx

Now in Default.aspx page take two textboxes and two labels and one button. The button will function like, when we click the button TextBox1 and TextBox2 values will be transferred to Default2.aspx page.



Now write the following code on Default.aspx.cs page inside button1_click method.


protected void Button1_Click(object sender, EventArgs e)
{
string url;
url = "Default2.aspx?name=" +
TextBox1.Text + "&email=" +
TextBox2.Text;
Response.Redirect(url);
}

Step 2:

Now on Default2.aspx page take two labels and one TextBox as shown in below picture.



After that write the following code on Deeeeefault2.aspx.cs inside Page_Load method.


protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Request.QueryString["name"];
Label2.Text = Request.QueryString["email"];
TextBox1.Text = Label2.Text;
}



If you face any difficulty in any phase feel free to comment. Very soon I will post about how cookies store page values and how to access that stored data.

Related

ASP.net Tutorial 6847044884868495619

Post a Comment

emo-but-icon

Search Here

Popular query

Follow Us

Ads By Google

Get free Update

Enter your email address:

E-mail verification is must for complete subscription

Delivered by FeedBurner

Circle AFS on Google Plus!

Follow AFS Google+ page
 

Side Ads

DMCA protected
Information, images and the content on this blog is Copyright ©AFS2011-2018. Please do not copy Any content for commercial purpose else we have to take a legal action. Thanks !!

Total Pageviews

Recent

free counters
 

Connect Us

Speech by ReadSpeaker

item