QueryString1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QueryString1.aspx.cs" Inherits="QueryString1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 90px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style2">StudentId</td>
<td>
<asp:TextBox ID="IDTextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">StudentName</td>
<td>
<asp:TextBox ID="NAMETextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">StudentAge</td>
<td>
<asp:TextBox ID="AGETextBox" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td>
<asp:Button ID="SENDButton" runat="server" OnClick="SENDButton_Click" Text="Send" />
</td>
</tr>
</table>
<div>
</div>
</form>
</body>
</html>
QueryString1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class QueryString1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SENDButton_Click(object sender, EventArgs e)
{
Response.Redirect("QueryString2.aspx?id="+Server.UrlEncode(IDTextBox.Text)+"&name="+ Server.UrlEncode(NAMETextBox.Text)+"&age" + Server.UrlEncode(AGETextBox.Text));
}
}
QueryString2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QueryString2.aspx.cs" Inherits="QueryString2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 152px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">STUDENT ID</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">STUDENT NAME</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">STUDENT AGE</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
QueryString2.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class QueryString2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = Request.QueryString[0];
TextBox2.Text = Request.QueryString[1];
TextBox3.Text = Request.QueryString[2];
}
}
0 Comments