1. jsonresult
1 Using System. Web. MVC;
2
3 // Public actionresult index ()
4 Public Jsonresult index ()
5 {
6 VaR Province = From PIn New Models. northwinddatacontext (). Province
7 Select P;
8
9 Return JSON ( New
10 {
11 Page = 1 ,
12 Total = province. Count (),
13 Rows = province. tolist ()
14 },
15 Jsonrequestbehavior. allowget
16 );
17 }
2. html helper
@ Html. Textbox ("username") <-><Input ID="Username" Type="Text" Value= "" Name="Username">
@ Html. Textbox ("username", null, new {id = "txtusername"}) <-><Input ID="Txtusername" Type="Text" Value= "" Name="Username">
@ Html. Textbox ("username", null, new {id = "txtusername", style = "width: 100px;"}) <-> input id = " txtusername " type = " text " value = "" Style = " width: 100px; " name =" username " >
@ HTML. textbox ("username", null, new {id = "txtusername", @ class = "highlight "}) <-> input id =" txtusername " class = " highlight " type =" text " value = "" name = " username " >