Problems encountered in asp.net mvc project and solutions ---- ajax request Error 500, multi-table data request, mvc ---- ajax

Source: Internet
Author: User

Problems encountered in asp.net mvc project and solutions ---- ajax request Error 500, multi-table data request, mvc ---- ajax

An Error 500 occurs in ajax requests. However, the function is to divide a page into two parts. Click the right navigation bar and use ajax requests to request data. The corresponding page appears on the right, at that time, partialAction was used and the 500 error was reported, mainly because on this action, one page cannot be called by ajax to request another page. At that time, I was not very familiar with the entity set. For the automatically generated model layer, I thought it could not be changed. So I had to have several controllers to access several tables, so I had to have several actions, it seems that there is no way to achieve this. The final answer is to write another model class, and then add the desired table.

Public class moretable {
Public List <table1> Table1 {get; set ;}
Public List <table2> Tablr2 {get; set ;}
Public moretable (){
Table1 = new List <table1> ();
Table2 = new List <table2> ();
}
} In this way, you can access data in multiple tables.

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.