Passing control's ID to javascript via ScriptControlDescriptor
- by markiz
I create a control in CreateChildControls():
HtmlGenericControl mycontrol= HtmlGenericControl("li");
mycontrol.ID = "controlID";
controlId = mycontrol.ID;
protected virtual IEnumerable<ScriptDescriptor> GetScriptDescriptors()
{
ScriptControlDescriptor descriptor = new ScriptControlDescriptor("Project.TEditor", this.ClientID);
descriptor.AddProperty("controlId", controlId);
return new ScriptDescriptor[] { descriptor };
}
Then in javascript i try to find this control using the ID property:
alert($get(this.get_controlId()));
I get null because the actual control ID has a prefix that was added by asp.
How to solve that?