read variable from content page to usercontrol in masterpage

S

Shailesh Patel

Hi,
I havea variable in cotent page. I want to read that variable into
usercontrol located in master page.
Is there any trick to read it in usercontrol?

Thank you in advance.

Shailesh
 
B

bruce barker

the proper way is to define an interface (in app_code) and have pages
that have the variable implement the interface. then the master page can
just cast this.Page to the interface and access the variable. this way
the master page can easily detect pages that do not.


-- bruce (sqlwork.com)
 
S

Shailesh Patel

Hi Bruce,
Can you please give me some short example to understand better.
I apperetiate your feedback.

Thank you.
 
D

David Grover

Another way is to raise an event in the page and capture or handle the event in the user control.

I have shared this approach over at:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top