Those who have used the Asp.net MVC label know that this label is very convenient. They do not need to assign values to JS, but are directly bound to ASP. net mvc labels. The premise is that the background method must return a page, that is, return view ("~ /Controller/View "). Of course, this method also has its limitations, rather than void and other types of methods. This MVC tag binding method is generally used when a large number of background database fields need to be received on the front-end page, such as personal information and enterprise information. In general, a small amount of data can be directly requested using Ajax.
In the ASP. net mvc background, you need to return an object
That is:
Public actionresult getinfo ()
{
Myentities entity1 = new myentities ();
// Instantiate an object or table
Tableobject Table1 = entity1.tableobject. First (t => T. ID = "primary key of the returned table ");
Return ("/XXX/myview. aspx", Table1 );
}
Then, add a reference to the object on the myview. ASPX page. You can use the MVC tag to bind the object.
If multiple table fields are required, multiple objects (tables) must be returned similarly ).
At this time, you can create a new class under the model file, and then encapsulate all the tables you need in this class. when an object is returned in the background, you only need to return this new class. You can try it on your own.