How to access a control on a web form from anoter web form

hi all

I have this scenarios

i have two web forms, one called form1 and the other called form2

form1 has a label with id "lbl1"

is it possible to access lbl1 from form2, change its text permenantly?

thanks.

0
MinaSamy
3/25/2009 10:56:34 AM
📁 asp.net.free-for-all
📃 9281 articles.
⭐ 0 followers.

💬 4 Replies
👁️‍🗨️ 2809 Views

 

refer: http://dotnetslackers.com/Community/blogs/haissam/archive/2007/11/26/ways-to-pass-data-between-webforms.aspx


SSN
Please remember to click "Mark as Answer" on the post that helps you.
0
suthish
3/25/2009 11:26:25 AM

MinaSamy:

hi all

I have this scenarios

i have two web forms, one called form1 and the other called form2

form1 has a label with id "lbl1"

is it possible to access lbl1 from form2, change its text permenantly?

thanks.

Hi once you navigate from the page you can only access its properties if you you cant chnage it

when you return back the value will again be new one unless you assign it

So you can use session variables and set the session variable

Session("lbl") = "Hello"

Label1.Text = Session("lbl").ToString()

 

hence whenever you chnage value of Session variable it will be reflected in ur label


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
3/25/2009 11:30:51 AM

Thanks for you help

but what I mean is there a method to add a control to form2 permenantly

so even after i close the browser and re-open it the added control is still there .

thanks.

0
MinaSamy
3/25/2009 11:58:55 AM

MinaSamy:

Thanks for you help

but what I mean is there a method to add a control to form2 permenantly

so even after i close the browser and re-open it the added control is still there .

thanks.

Add the control in ur aspx it will be there permanently


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
3/25/2009 12:22:30 PM