When using clientid, you may encounter the following problems:
Obtain the Server Control identifier generated by ASP. NET.
Problem 1: The Control ID of Asp.net must be used in the page JavaScript of the user control.
Problem 2: The Asp.net Control ID must be used in the subpage JavaScript of the master page.
Solution:
Document. getelementbyid ("<% = textbox1.clientid %>"). value = "1234567 ";
ThisCodeYou can access the server-side controls on the client. Because ASP. NET generates different names for displaying the server-side controls on the client, this function is useful.
Note: The Asp.net controls are static controls (controls added by tools)
Question 3: How to obtain the clientid of the dynamically created control exists: you cannot use "<% = textbox1.clientid %>" on the page ". method (the method is not available because the control is dynamically created), and textbox1.clientid cannot be used in the page script (the obtained ID is incorrect ).