If the page is simple to use JS to create, to write a lot of code, and not intuitive.
In ASP. NET, we can actually create a user-defined control that returns the HTML code of the user's custom control via an AJAX request.
public static string Rangeruscontrol (String controlname) {StringBuilder build = new StringBuilder (); HtmlTextWriter htmlwriter = new HtmlTextWriter (new StringWriter (build)); UserControl UC = new UserControl (); Control Ctrl=uc. LoadControl (controlname+ ". ascx");//load user-defined control TextBox TxtBox1 = Ctrl. FindControl ("TextBox1") as textbox;//gets the control with ID "TextBox1" txtbox1.text = "test"; Initializes a string result to the control; try {Ctrl. RenderControl (HTMLWriter); } catch {} finally {Htmlwriter.flush (); Result=build. ToString (); Return result;//returns the HTML code of the control} Htmlwriter.flush ();