How to access div tags of custom control on master page

Can we access the div tags of the custom control on the home page? I am trying to change the background color for each of the div tags on some event.

0


source to share


2 answers


Something like this should work (in C #):

Control myControl = this.Page.Master.FindControl("[Your name here]");

      



Then you can do whatever you want with the control. If it's a Panel control (for a div), you can use it that way, or if you're using an HTML server side control, you can use it that way.

+1


source


The best way is to make a public property in a custom control, which can then be set directly from the master page.



0


source







All Articles