Hi all ,
I have created dynamic controls in ASP.NET as following ..
first i have created checkbox as
CheckBox chkDynamic = new CheckBox();
Then
TextBox txtDynamic = new TextBox(); txtDynamic.ID = "txtDynamic";
and these controls added in tablecell added in tableRow added in Table added in aspPanel(Only panel created at design page)
Now what i need.. when checkbox is selected i want to clear the txtDynamic Textbox using JavaScript
I tried following ways but not working..
chkDynamic.Attributes["onclick"] = "javascript:document.getElementById('" + txtDynamic.UniqueID + "').value='';";
also i tried with calling Method as
chkDynamic.Attributes.Add("onclick", "javascript:ClearText(this)");
but in this method following line giving me error not found "txtDynamic".. because the control added dynamicaly.
document.getElementById("<%= txtDynamic.ClientID %>").value="";
Thanks in advance....