Advertisement

11.12.2006 at 01:25PM PST, ID: 22057916
[x]
Attachment Details

How to tell control name when used in a content placeholder in conjunction with a master page

Asked by fruhj in Programming for ASP.NET

Tags: name, contentplaceholder, control

Hey everyone.

I have a page that worked great before I updated it to a masterpage based page...


My problem is this -

I have a label that I hide - ID =lblAlert Visible = false
Theres also a dropdown list right next to it. (called DDL_Term)

Thanks to some very cool people here on EE, I had a small line of javascript added to the dropdown so that if a user changes the drop down, the label becomes visible, without needing a full postback.

This javascirpt attaches to the drop down with the following command:
DDL_Term.Attributes.Add("onchange", "lblAlert.style.visiblity='visible';")

The trouble is, now that this is in a master page, my alert label doesn't have an ID=lblAlert,
now it's something like _ctl0_contentPlaceHolder1_lblAlert

I can certainly hard code this, but is there a  way to get the system to use the correct value?
that way if this page ends up in a different contentPlaceHolder someday, I won't have to come back and re-code?

(I tried   DDL_Term.Attributes.Add("onchange", lblalert.ID & ".style.visiblity='visible';") but that appears to = lblalert, not _ctl0_contentplaceholder1_lblalert
thanks in advance!
- Jack
Start Free Trial
[+][-]11.12.2006 at 01:37PM PST, ID: 17926581

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Programming for ASP.NET
Tags: name, contentplaceholder, control
Sign Up Now!
Solution Provided By: fruhj
Participating Experts: 0
Solution Grade: B
 
 
[+][-]11.13.2006 at 08:22PM PST, ID: 17935802

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32