Camillia
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
In Content page
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;" />
In Content page
<asp:Label runat="server" ID="lblMsgFax" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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(lb lId);
alert(lblObj);
lblObj.innerHTML = "";
Do I need to change that property somehow to set the value?
public Literal PageLabel { get; set; }
I put an alert in the javascript and lblObj is null
var lblObj = document.getElementById(lb
alert(lblObj);
lblObj.innerHTML = "";
Do I need to change that property somehow to set the value?
ASKER
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
<td width="310"><span class="feedback">Please click 'Next' to refer by fax.</span></td>
no ID. I'll dig deeper
ASKER