1

I have a master page for four user controls. I have a tab strip that allows me to go to each control from the master page. I am trying to reference one user control's event in another user control. I want to disable a button on uc2 based on a button click on uc1.

3 Answers 3

0

Use the Control.FindControl() method to find the control and set the Control.Enabled property

1
  • It will not let me just reference the control like you provided above. I can write that code in the master pages file but i need to reference theses controls in my user control page. when I type in Control. --> Visual Stuido gives me two options equals and reference equals. Its like my user control isn't referenced or can't be referenced in another user control Jun 24, 2014 at 13:57
0

I would set this up by setting properties on the usercontrols that would toggle data on instantiation. Then when you click your button in one user control you can ,on the post back in the masterpage, set a property on one and check that property in the master page and then toggle a property in the other control. This should allow you to enable or disable a control or even multiple controls this way.

Here's a reference to setup and manipulate properties in a usercontrol

http://www.dotnetfunda.com/articles/show/16/creatingsetting-properties-of-user-control-in-aspnet

2
  • I'm looking to set properties of a user control from another user control not an aspx page. Jun 24, 2014 at 20:33
  • @JacobDeskin yes but the user controls have to be placed somewhere to be used. In this case the master page so if you toggle a property in one user control and then look at that property in the next user control if(usercontrol1.property == true) usercontrol2.property == false;
    – CBRRacer
    Jun 24, 2014 at 21:55
0

Dim area as

RadNumericTextBox = TryCast(Me.Parent.FindControl("tb_AreaSF"), RadNumericTextBox)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.