Reference Textbox in MasterPage

D

David C

I have a MasterPage that contains 4 TextBox controls that I am using to hold
values from page to page in my website. I am trying to refer to them in my
code-behind of my web pages as follws and I am getting the error "Name
'txtPropertyCode' is not declared.". How can I access the values in the
MasterPage? Thanks.
-David

LblProperty.Text = DBClass.GetPropertyHeading(txtPropertyCode.Text)
 
B

bruce barker

while you can use Master.FindControl(), the best way is to expose the
controls as public properties on the master. then add a <@MasterType>
directive to your pages. then you can use: Master.MyControl


-- bruce (sqlwork.com)
 

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,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top