Use Grid. MVC and mvcgrid. mvc in ASP. NET mvc.
I haven't written a blog post on ASP. NET for a long time, so I have to concentrate on my work. I wrote a blog post on MVC today, and I also practiced it myself. I used grid. mvc to display data.
OpenManage Nuget Packages, SearchGrid. mvcAnd install it:
Create a controller:
Create a view:
Now let's look for some data to display. Use the data we demonstrated earlier, such as Fruit:
OK, open OctoberController again, modify and add the highlighted code:
Open the created view again:
Browsing and real-time Demonstration:
In aspnet MVC mode, how does one use the GridView control?
MVC pattern ??? GridView control ???
These two are controls and software frameworks. What is the relationship between them ????
MVC is just a design concept.
In aspnet, I use the GridView to link one of the fields to another page to become a hyperlink.
// Assume that you have an item named id in the data source bound to gridview1, and defult. aspx is the page that I assume you want to jump.
<Asp: GridView runat = "server" ID = "gridview1">
<Columns>
<Asp: HyperLinkField Text = "click to jump" NavigateUrl = 'defult. aspx? Id = <% # Eval ("id") %> '/>
<Asp: BoundField DataField = "id"/>
</Columns>
</Asp: GridView>
When you bind a data source to gridview1, each row will have a hyperlink "click to jump", and the id of the current row will be uploaded to the defult. aspx page.