Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Anyway to find content control in usercontrol using javascript?

I have a master page, content page and a user control.
1. In the user control, i have a button that I call javascript on usercontrol to clear some textfields.

2. In content page, I have a label that I also want to clear when the user-control button is clicked.

Anyway I can access this label in usercontrol, using javascript? this is what I have now.

In user control

<script type="text/javascript">
    function clrCtrl() {
        document.getElementById("<%= search_category_city.ClientID %>").value = "";
    }

 <asp:Button  ID="btnClear" Text="Clear" runat="server" OnClientClick="clrCtrl();return false;"  />

Open in new window


In Content page
<asp:Label runat="server" ID="lblMsgFax" />

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

i'll try today, thanks for responding
I tried this but get a NULL error for the label. I put a debug step and this line is always null

public Literal PageLabel { get; set; }

I put an alert in the javascript and lblObj is null

 var lblObj = document.getElementById(lblId);
        alert(lblObj);
        lblObj.innerHTML = "";

Do I need to change that property somehow to set the value?
the control yeilds as this

<td width="310"><span class="feedback">Please click 'Next' to refer by fax.</span></td>

no ID. I'll dig deeper