Introduction
With the help of the qurrystring we can also send the multiples values from one page to another page. This is very important topic of the ASP.NET.
Implementation
Create page named first.aspx . There is three textbox and a button in this page. You can see it in the HTML code
HTML code for first.aspx page
<body>
<form id="form1" runat="server">
<div>
Enter your Name :
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
Enter Address
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
Enter Email
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="send data to next page" />
</div>
</form>
</body>
C# code for first.aspx pageusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class first : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
// method to send multiple value from querystring
Response.Redirect("second.aspx?name=" + TextBox1.Text + "&address=" + TextBox2.Text + "&email="+ TextBox3.Text); }
}
Create page named second.aspx . Drag and drop three label from toolbox.
HTML code for second.aspx page
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lbl_msg" runat="server"></asp:Label>
<br />
<br />
<asp:Label ID="lbl_add" runat="server"></asp:Label>
<br />
<br />
<asp:Label ID="lbl_email" runat="server"></asp:Label>
</div>
</form>
</body>
C# code for second.aspx page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class second : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// method to catch value from querystringat next page
lbl_msg.Text = Request.QueryString["name"].ToString();
lbl_add.Text = Request.QueryString["address"].ToString();
lbl_email.Text = Request.QueryString["email"].ToString(); }
}
Conclusion
Through this article, you have learned how to send multiple values from one page to another page using querystring.
Matur Nuwun....
ReplyDeleteThis is good help for me
ReplyDeletet is really a great work and the way in which u r sharing the knowledge is excellent.
ReplyDeleteThanks for helping me to understand basic concepts. As a beginner in dot net programming your post help me a lot.Thanks for your informative article.Dot Net training in chennai | Dot Net training institutes in chennai | Dot Net training in velachery
ReplyDeleteIts a wonderful post and very helpful, thanks for all this information.
ASP.Net Training in Delhi
Thanks a lot. You have done an excellent job. I enjoyed your blog . Nice efforts.
ReplyDeleteVisit us: Dot Net Training Online India
Visit us: .Net Online Training Hyderabad
Lakshya IAS Academy is a well-known Institute and the Best UPSC in Mumbai preparing candidates for the Civil Services Examination. It is one of the known IAS coaching centers in Mumbai, which is known for offering high-quality guidance to aspirants.
ReplyDelete