how to do pass Values from one page to another page

Posted by reddysankark-13471 under ASP.NET on 10/28/2012 | Points: 10 | Views : 2382 | Status : [Member] | Replies : 6
Hi,

I need one coding. if you can submit any government application it goes to another page.In this page it will again ask edit,submit.if you can submit means it will save in server.else you can edit means again editable textbox coming

sankarreddy


Responses

Posted by: Santhi on: 10/28/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

you can pass the values through the query string.


Regards,
V. Santhi.

Thanks & Regards,
Santhi .V

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Denon6 on: 10/28/2012 [Member] Starter | Points: 25

Up
0
Down
hi ,
also u can pass values using sessions .

regards

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 10/28/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Reddysankark

try this code

First Page Code

Client Side Code

<form id="form1" runat="server">
<asp:TextBox ID="txt1" runat ="server" ></asp:TextBox>
<asp:Button ID="bt1" runat ="server" Text ="Submit" onclick="bt1_Click" />
</form>


Server Side Code

protected void Page_Load(object sender, EventArgs e)
{
string st1 = Request.QueryString["Name"];
if (st1 != "")
{
Response.Write("Page1" + st1);
}
}
protected void bt1_Click(object sender, EventArgs e)
{
Response.Redirect("Page200.aspx?Name=" + txt1.Text);
}
}




Second Page Client Side Code

<form id="form1" runat="server">
<asp:TextBox ID="txt1" runat ="server" ></asp:TextBox>
<asp:Button ID="bt1" runat ="server" Text ="Submit" onclick="bt1_Click" />
</form>


Second Page Server Side Code

protected void Page_Load(object sender, EventArgs e)
{
string st1 = Request.QueryString["Name"].ToString();
if (st1 != "")
{
Response.Write("Page1" + st1);
}

}
protected void bt1_Click(object sender, EventArgs e)
{
Response.Redirect("Page100.aspx?Ename=" + txt1.Text);
}


Mark as Answer if its helpful to you

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 10/29/2012 [Member] Starter | Points: 25

Up
0
Down
best way is to use session or query string

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Deepraj on: 10/29/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
There are two ways
1) Passing values using QueryString as illustrated by Jayakumars
2)Using Session this is simple.
For Example:- Consider two pages one.aspx and two.aspx
In one.aspx .cs write
Session["name of ur choice"]=Whatever value you like to pass. i.e Session["myname"]=30.
In two.aspx .cs access it
as Session["myname"].ToString() gives value 30

Passing values using Session is very secure.




reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sourabh07 on: 10/29/2012 [Member] Starter | Points: 25

Up
0
Down
hi to all..

I think the best way to pass the value is through Session because according to my perspective, it can destroy accordingly and hide from the end user.
But in case of Query String we need to encrypt the value if want to hide from the end user.

Sourabh07

reddysankark-13471, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response