Hey guys..
Have started developing my first web application in c#.I want to know how can we pass value of a label on one form to a label on another form
say Form1 label1 has a text "xyz"
i need this value on form2 label1
Hey guys..
Have started developing my first web application in c#.I want to know how can we pass value of a label on one form to a label on another form
say Form1 label1 has a text "xyz"
i need this value on form2 label1
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Rahul Kumar SaxenaRank #36 · 36.5K reputationPosted Mar 4, 2009, 9:29 PM EST
Vipul Kelkar35 reputationPosted Mar 4, 2009, 9:59 PM EST
It works with query string.
But can i get a sample code for doin it with Session.I havent worked with session yet
for query string i used this
Response.redirect("form.aspx?Value1"=textbox1.text);
Can we pass more that one value here ???
Thanks
Vimal KandasamyRank #2,151 · 661 reputationPosted Mar 4, 2009, 10:06 PM EST
yes, you can pass more than one value by seperate them with & symbol;
for session use the following,
Session["Name"]="value"
Response.Redirect("newpage.aspx");
in the next page u have to receive it by using the code
String name=Session["Name"].ToString();
Vipul Kelkar35 reputationPosted Mar 4, 2009, 11:01 PM EST
Vipul Kelkar35 reputationPosted Mar 4, 2009, 11:41 PM EST
I am not able to pass an array and integer through sessions.I have done it as given below
FOR INTEGER
Session["Count"] = cnt;
int count = Session["Count"] //to recieve on 2nd form
FOR ARRAY
Session["Arr"] = arry // arry is a String Array
String [] arry = Session["Arr"];
Please help me out
Dinesh BeniwalRank #9 · 64K reputationPosted Mar 25, 2009, 1:18 AM EDT