Some netizens read this article ASP. net mvc after loading ASCX, and for the value of the http://www.cnblogs.com/insus/p/3643254.html, asked Insus. NET. Instead of assigning values in the control controller, you want to use jQuery in the view to obtain or assign values to the control values in the user control. What should we do?
The following Insus. NET takes less time to give a simple example to demonstrate and share the implementation methods.
Before implementation, modify the public static HtmlString RenderControl <T> (string path) method in the AscxUtility. cs class.
Because Web Control must be placed in the form to run.
Create a user control Uc1.ascx:
In the controller, create two actions:
Create View:
Mark 3 above is the HTML string obtained from the user control Render and displayed on the Div tag.
Mark 4 and Mark 5 are used to obtain values and assign values.
Real-time Demonstration:
The following is another method, which is presented using the Razor syntax. You can follow the four steps below to modify it and avoid writing public ContentResult ShowUc () Action in the controller.
The running result remains the same.