Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
How can i write below code by using Query String...........



Forrm1....
VB
Application["DEMO_APPLICATION"] = txtname.Text;
      Application["DEMO_APPLICATION1"] = txtpwd.Text;
      Application["DEMO_APPLICATION2"] = txtpassword.Text;
      Application["DEMO_APPLICATION3"] = txtadd.Text;
      Application["DEMO_APPLICATION4"] = txtfull.Text;
      Application["DEMO_APPLICATION5"] = DropDownList1.SelectedIndex;
       Response.Redirect("default3.aspx");


form2....
C#
TextBox1.Text = Application["DEMO_APPLICATION"].ToString();
        TextBox2.Text = Application["DEMO_APPLICATION1"].ToString();
        TextBox3.Text = Application["DEMO_APPLICATION2"].ToString();
        TextBox4.Text = Application["DEMO_APPLICATION3"].ToString();
        TextBox5.Text = Application["DEMO_APPLICATION4"].ToString();
        TextBox6.Text = Application["DEMO_APPLICATION5"].ToString();
Posted

Dear Friend,

Here you can use ArrayList class in order to store the values of different application level variable at different indexes and then passing the array object in query string and then assigning the values to the text boxes in form2.
 
Share this answer
 
In form one
Response.Redirect("default3.aspx?DEMO_APPLICATION="+txtname.Text+"&    DEMO_APPLICATION1=" +txtpwd.Text+"&DEMO_APPLICATION2="+txtpassword.Text+"&DEMO_APPLICATION3="+ txtadd.Text+"&DEMO_APPLICATION4="+ txtfull.Text+"&DEMO_APPLICATION5="+ DropDownList1.SelectedIndex);

And in form2 you need to access the query string

like 

string demoApplicationName=Convert.Tostring( Page.Request.Param["DEMO_APPLICATION1"])
same for other variable DEMO_APPLICATION2


Replace demoApplicationName with the textbox you want to set the data into.
 
Share this answer
 
v3
Comments
rockpune 21-Feb-12 0:42am    
thanx brother
Varun Sareen 21-Feb-12 0:47am    
not a better solution i would say as the length of query string is limited to 256 bytes
rockpune 21-Feb-12 0:55am    
in the place of demoapplicationname what i have to write
Varun Sareen 21-Feb-12 5:19am    
I have updated the solution of sudip saha please check

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900