Use Jqgrid's c#/asp.net MVC Developer's Gospel Jqgrid-asp.net-mvc

Source: Internet
Author: User
Tags jqgrid

Do you use Jqgrid?

Do you want to use Jqgrid in c#/asp.net MVC?

You might have been busy with fiddler for 2 hours to analyze Jqgrid's request URL. (If you want to use Jqgrid's search function)

Then you probably wrote hundreds of lines of C # code for the Jqgrid crud and search feature. Not sure there are any bugs.

If you have a painful experience like this, then JQGRID-ASP.NET-MVC is your gospel.

Jqgrid-asp.net-mvc is a C # open source project for host on GitHub. It's on GitHub's address is HTTPS://GITHUB.COM/WEIMINYE/JQGRID-ASP.NET-MVC

JQGRID-ASP.NET-MVC's slogan is "write the fewest code to use Jqgrid"

Using JQGRID-ASP.NET-MVC has the following benefits to save you at least 8 hours of working time and reduce bugs:

not using JQGRID-ASP.NET-MVC after using Jqgrid-asp.net-mvc save you time.
You take the time to analyze Jqgrid's request URL with fiddler. No need to spend time analyzing Jqgrid's request URL with fiddler 2 hours
You're going to write a lot of Jqgrid-related C # code Save at least 500 lines of code right away 6 hours
If Jqgrid is updated, you should update your code as well. You don't need to update your code, you only need to update the Jqgrid ASP. DLL reference Not counted
Because your code only brings together a person's experience that could lead to bugs you don't know. Jqgrid ASP. NET MVC is an open source project, so you can bring together the experience of the world's yards to minimize bugs Not counted

I'm done with the benefits of using Jqgrid ASP. NET MVC and using Jqgrid ASP.

Let's talk about using Jqgrid ASP.

Using Jqgrid ASP. NET MVC is simple, with a few steps as follows:

  1. First, go to Jqgrid ASP. NET MVC GitHub site https://github.com/weiminye/jqgrid-asp.net-mvc Download the source code to compile locally
  2. After the compilation is passed, open the jqgrid-asp.net-mvc\jqgrid-asp.net-mvc\bin\debug directory
  3. Add Jqgrid-asp.net-mvc.dll to your ASP. NET MVC project. Note: in order For more developers around the world to make Jqgrid ASP. Jqgrid ASP does not host DLLs on NuGet, the DLL can only be obtained by downloading source code compilation. Until one day, Jqgrid ASP. NET MVC felt that it had done enough, could come out to see people, could be destroyed, and would host on NuGet.
  4. Open the Controller class you want to use Jqgrid.
  5. Add the following references to the file header:
    Using Jqgrid_asp.net_mvc;

  6. Write the Read and search methods that you want to be jqgrid in JavaScript by using the following format.Note: Do not modify the parameter names in the method
    1#region Jqgrid Read and search23Public ActionResult Indexjsonlist (BOOL _search,string nd,Int? RowsInt? PageString Sidx,StringSord, Jqgrid_asp.net_mvc.Filter filters)4{5ReturnJqgrid.load (6 db. Persons,//Replace with your own business logic code7 D = D.firstname,//Replace with your own business logic code8 s =New// replace your own business logic code  9  {10  S.id,11  S. Firstname,12  S.lastname, 13  S.city,14  S.zip,15 16}, rows, page, _search, ref filters); 17 18 }19 20  #endregion       

  7. Write the update method that you want to be jqgrid in JavaScript by using the following format. Note: Do not modify the parameter names in the method
    String oper){return Jqgrid.updateforjqgrid (person, Oper, Addperson, Editperson, Deleteperson);  4}    
  8. Write your own add, modify, and delete business logic methods in the following format.
    1PrivateActionResult Addperson (person person)2{3//Replace with your own business logic code4var newpersonentity =NewPerson ();5 newpersonentity. FirstName =Person. FirstName;6 newpersonentity. LastName =Person. LastName;7 newpersonentity. City =Person. City;8 newpersonentity. Zip =Person. Zip;910Db. Persons.add (newpersonentity);11Db. SaveChanges ();1213Return Content ("ADD success");14}1516PrivateActionResult Editperson (person person)17{18//Replace with your own business logic code19var editpersonentity = db. Persons.single (p = p.id = =Person.id);Editpersonentity. FirstName =Person. FirstName;Editpersonentity. LastName =Person. LastName;Editpersonentity. City =Person. City;Editpersonentity. Zip =Person. Zip;2425Db. SaveChanges ();2627Return Content ("Update success");2829}30PrivateActionResult Deleteperson (person person)31 {32 // replace your own business logic code 33  person.id);  db. Persons.remove (deletepersonentity); 35 36  db. SaveChanges (); 37 38 return Content ( Span style= "color: #800000;" > "delete success" 39}                 
  9. Compile your solution. You can test the results of your use of Jqgrid ASP.

If you do not understand the above steps, you can refer to the controllers\homecontroller.cs file below Jqgrid-asp.net-mvc.demo.web.

Look, it's so simple! Did you implement the JQGRID-ASP.NET-MVC slogan-"Write the least code to use Jqgrid"?

If you have any questions about JQGRID-ASP.NET-MVC, have any dissatisfaction, have any comments, in this article (http://www.cnblogs.com/adalovelacer/p/4176132.html) leave a message here, I'll answer you. Because I know your opinion will make JQGRID-ASP.NET-MVC better, welcome to shoot Bricks!

Oh? Is it strange why I can answer you? Because I am the creator of Jqgrid-asp.net-mvc! :)

First of all, I as a 2010 years on human flesh FQ to the Silicon Valley yards, I do open source project is of course in English as the first language. But! I always remember, I am a Chinese, many years ago, I also and everyone, in Guangzhou, in Beijing, struggling, I still remember that time because of poor English, encountered problems can only find the pain of Chinese information. So this time I ran to cnblogs for Jqgrid-asp.net-mvc to set up a Chinese course and page, that is, I hope we do not have the same pain. I hope that the country's yards farmers can also share the JQGRID-ASP.NET-MVC progress with the U.S.

So if you think Jqgrid-asp.net-mvc is great, please support me and go to Jqgrid-asp.net-mvc's GitHub https://github.com/weiminye/ Jqgrid-asp.net-mvc as follows, that's The star star.

You can also follow me on my GitHub https://github.com/weiminye so that I can see it as soon as I update the code. I will have more open source projects, JQGRID-ASP.NET-MVC is just my first open source project.

Of course, I hope you can donate your code to make JQGRID-ASP.NET-MVC better!

Use Jqgrid's c#/asp.net MVC Developer's Gospel Jqgrid-asp.net-mvc

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.