The following does not work:
var EtxtDOB = $get('<%=FormView1.FindControl("frmEd开发者_开发问答itPerson").FindControl("EtxtDOB").ClientID %>');
How can I find this nested control in javascript?
I find it's a lot clearer code-wise to explicitly emit the IDs of the controls you want to access via Javascript in the page's code-behind. Something like:
Page.RegisterClientScriptBlock("clientIDs", "var myControlID = '" + myControl.ClientID + "';");
Then you can access this anywhere in your client-side script and it's a lot cleaner:
var ExtODB = getElementById(myControlID);
If you want to get fancy create a utility function that does this for you... or create a custom attribute that automatically does this.
Usually you use 'getElementById' or similar from Javascript. If your control is named 'EtxtDOB' then this might work for you:
document.getElementById('EtxtDOB').setAttribute()....
(Not sure what the $get refers to...)
精彩评论