Reference Textbox in MasterPage

  • Thread starter Thread starter David C
  • Start date Start date
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)
 
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)
 
Back
Top