If the page simply use JS to create, to write a large number of code, and not intuitive. 
In asp.net, we can actually create user-defined controls that return user-defined HTML code through AJAX requests. 
 
 
 Copy Code code as follows: 
 
 
 
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;//get control with id "TextBox1" 
 
Txtbox1.text = "Test"; Initializes string result to the control; 
 
Try 
 
{ 
 
Ctrl. RenderControl (HTMLWriter); 
 
} 
 
Catch {} 
 
Finally 
 
{ 
 
Htmlwriter.flush (); 
 
Result=build. ToString (); 
 
} 
 
Return result;//The HTML code of the control 
 
} 
 
Htmlwriter.flush ();