Use Grid. MVC and mvcgrid. mvc in ASP. NET mvc.

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.