30
Reply

Fetch one page value to another page without using state-managment ?

Rakesh Singh

Rakesh Singh

8y
7.9k
1
Reply

    In Dot Net provides Request.Form Collection class to retrieves the values of form elements which posted from the HTTP request body in a form using the post method.Example : Request.Form("TextBox1")TextBox1 - name of the form element is to retrieve values

    here we have two options one of use CrossPage Posting with PreviousPage.FindControl("") and other one is Request.Form[""]

    Request.Form("TextBox1")

    You can pass values from one page to another by followings.. Response.Redirect Cookies Application Variables HttpContextResponse.RedirectSET :Response.Redirect("Defaultaspx?Name=Pandian); GET :string Name = Request.QueryString["Name"]; CookiesSET :HttpCookie cookName = new HttpCookie("Name"); cookName.Value = "Pandian"; GET :string name = Request.Cookies["Name"].Value; Application VariablesSET :Application["Name"] = "pandian"; GET :string Name = Application["Name"].ToString();

    Request.Form["txtName"] can be used for retrieving value one page to another

    there is a feature in .net called cross page posting

    By the writing these code: PreviousPage.FindControl("ControlName");and other one is Request.Form[""] name of the form element is to retrieve values

    Request.Form["txtName"] can be used for retrieving value one page to another

    through ajax

    We can use PreviousPage method and access property or control of previous page. just specify virtualpath in Html of page where we want to access property or control of page.

    use Page.FindControl("ID") u can transfer the data from one page to other

    protected void Page_Load(object sender, EventArgs e){if (PreviousPage != null && PreviousPage.IsCrossPagePostBack){ TextBox txtNew = (TextBox)PreviousPage.FindControl("txtPre"); String str= txtNew.Text;}else{Response.Redirect("Prev.aspx");}}

    Use the static variable application object.

    Request.Form CrossPage Posting Using static variables.

    using public static variable

    Using static variables.

    create object for the form you want to call. and then create static management and call the variable

    by using Page.PreviousPage.FindControl("");If you use Server.Transfer()

    by using Page.PreviousPage.FindControl("");If you use response.transfer();

    It is possible to cross page postback.you can try this code.**************Default.aspx******************

    Enter Class Name
    Enter Techers Name
    ***************Default2.aspx********************

    ******************Default2.aspx.cs***********************protected void Page_Load(object sender, EventArgs e){if (PreviousPage != null && PreviousPage.IsCrossPagePostBack){TextBox txtcname = (TextBox)PreviousPage.FindControl("txtclassname");TextBox txttname = (TextBox)PreviousPage.FindControl("txttechername");lblcname.Text = "Your Class is:-    " + txtcname.Text;lbltname.Text = "Your Teacher Name is:-   " + txttname.Text;}else{Response.Redirect("Default.aspx");}}

    Here many answers but i want to say some difference if we use jquery localstorage it is also Fetch one page value to another page without using state-managment.

    right answer

    You can also use Cross-page posting.check the below link for refrenceshttp://www.c-sharpcorner.com/blogs/cross-page-posting-in-asp-net-web-pages1

    You can use Request.QuesyString and Request.Form

    Using Cross Page Postback We can Access one page value in another page

    pintoo yadav...i have mentioned without using state manament

    HI RakeshPlease read my publisher and subscriber article in the Same article ibam solving your issues using delegates and events ...Thanks

    HI RakeshPlease read my publisher and subscriber article in the Same article ibam solving your issues using delegates and events ...Thanks

    Nishant MittalExpand more

    you can use delegates and events for the same, also you can use constructors ....