How can I pass values from one form to another in Asp.net

前端 未结 1 755
日久生厌
日久生厌 2020-12-07 04:14

How can I pass values from one form to another in Asp.net?

Can you please give me an example?


I got it. Thanks for everyone for replying.

In so

相关标签:
1条回答
  • 2020-12-07 04:47

    Client side technology: 1)Query String 2)Cookies

    Query String: For SEnding:

    string name="abc"; Response.Redirect(" Page2.aspx?name= "+name);

    For Getting: On Page2.aspx string name=Response.QueryString.GetValue(" name ");

    For cookies you can use Sending: HttpCookie h=new HttpCookie(); h.Name="name"; h.Value="abc"; Response.Cookies.Add(h) ;

    Getting: string name = Request.Cookies('name');

    Server Side Technology: 1)Session

    For Setting: Session["Name"] = "Abc";

    For Getting: string str = Session["Name"].ToString();

    In Session you can pass any object type.

    0 讨论(0)
提交回复
热议问题