- Home
- Forum
- ASP.NET Core
- Grid not showing added line item when View is in a MVC Area.
Grid not showing added line item when View is in a MVC Area.
Hi,
Adding a new item line to a Grid control works okay when the view is in root folder structure of a MVC project. However if I use the Grid control inside a view that is in an Area it does not show the newly inserted row unless I refresh the whole page.
Any help in resolving this issue would be greatly appreciated.
SIGN IN To post a reply.
7 Replies
FS
Farveen Sulthana Thameeztheen Basha
Syncfusion Team
November 24, 2017 11:55 AM UTC
Hi Mahindra,
Thanks for contacting Syncfusion Support.
We have checked your query and prepared sample according to your requirement with CRUD operations. Please refer to the Sample Link:-
We need some additional information to find the cause of the issue. Please share us the following details.
1. Share us the Grid code example (both in server and client side).
2.If possible provide an issue reproducing sample or hosted link or reproduce the issue in the above sample and revert us back.
3. Exact scenario you have faced the issue.
4. Screenshot/Video demo to replicate the issue.
The provided details will helps us to analyze and provide you solution as early as possible.
Regards,
Farveen sulthana T
MM
Mahindra Morar
November 24, 2017 10:55 PM UTC
Hi Farveen,
Attachment: Webcore.Usertronics.ECommerceManagement_8219ab56.zip
I have attached the source code for a sample project I am working on with the issue of the data grid not updating when placed in a View which is inside a MVC Area.
The issue can be replicated by compiling the application and clicking on the Pricing menu and Price Types. Updating and deleting lines work without any issues, its only when adding a new item it does not appear in the grid unless I refresh the web page or click on the column header to reorder.
Thanks for your help.
Attachment: Webcore.Usertronics.ECommerceManagement_8219ab56.zip
FS
Farveen Sulthana Thameeztheen Basha
Syncfusion Team
November 27, 2017 04:29 PM UTC
Hi Mahindra,
We suspect that your reported problem will occur when we doesn’t return the proper value of the added record on the database. While deleting and updating the record, you have updated the values in the database. So we suggest you to return the value.Value in the JSON result.
Please refer to the code example:-
|
public ActionResult NormalInsert([FromBody]CRUDModel<Order> value)
{
if (value.Value.OrderID > 10000)
throw new Exception("OrderID must be above 1000");
orddata.Insert(orddata.Count, value.Value);
return Json(value.Value);
} |
After following the above solution, still facing the problem please get back to us with further details.
Regards,
Farveen sulthana T
MM
Mahindra Morar
December 1, 2017 10:45 PM UTC
Hi Faveen,
I have tried what you have suggested and still can't see the inserted row after saving unless I either sort by one of the grid columns or refresh the page.
Below is the code for the Crud actions.
public async Task<ActionResult> Crud([FromBody]CRUDModel<mdPriceType> value, string action)
{
var crudMsg = new mdCrudMessage();
if (value.Action == Constants.CrudOperations.LIT_INSERT)
{
var response = await PostWSObjectAsync<mdPriceType, mdPriceTypeResponse>(value.Value, URI_RESOURCE);
crudMsg = MessageFormatter.FormatCrudResultsHtml(response.CrudResults);
}
if (value.Action == Constants.CrudOperations.LIT_UPDATE)
{
var url = string.Format("{0}/{1}/{2}", URI_RESOURCE, value.Key, value.Value.Lockstamp);
var response = await PutWSObjectAsync<mdPriceType,mdPriceTypeResponse>(value.Value, url);
crudMsg = MessageFormatter.FormatCrudResultsHtml(response.CrudResults);
}
if (value.Action == Constants.CrudOperations.LIT_DELETE)
{
string lockstamp = Request.Headers["x-lockstamp"];
var response = await DeleteWSObjectAsync(Convert.ToInt32(value.Key), lockstamp, URI_RESOURCE);
if (response != HttpStatusCode.OK)
{
crudMsg.IsFault = true;
crudMsg.HtmMessage = Constants.LIT_ERROR_HTML_MSG;
}
}
if (crudMsg.IsFault)
return new BadRequestObjectResult(crudMsg.HtmMessage);
return Json(value.Value);
}
Do you have any other suggestions?
Mahindra
MP
Manivannan Padmanaban
Syncfusion Team
December 5, 2017 03:24 AM UTC
Hi Mahindra,
Sorry for the inconvenience caused.
We can reproduce the issue at our end and we suspected that <field="PriceTypeId”> value is null while saving the newly added row and if you are using the CRUD operation in server side then you need to return the value for the field which you have mentioned as <is-identity="true">.
Please refer to the code example: -
|
public async Task<ActionResult> Crud([FromBody]CRUDModel<mdPriceType> value, string action)
{
var crudMsg = new mdCrudMessage();
if (value.Action == Constants.CrudOperations.LIT_INSERT)
{
...
crudMsg = MessageFormatter.FormatCrudResultsHtml(response.CrudResults);
return Json(response);
}
} |
We have done the same in the sample also, which you have updated earlier that can be downloadable from the below location.
Please let us know if you need further assistance
Regards,
Manivannan Padmanaban
MM
Mahindra Morar
December 6, 2017 09:58 PM UTC
Thanks for all your help. Works a treat now.
FS
Farveen Sulthana Thameeztheen Basha
Syncfusion Team
December 7, 2017 04:24 AM UTC
Hi Mahindra,
Thanks for your update. We are glad to know that your reported problem has been resolved. Please get back to us if you need any further assistance.
Regards,
Farveen sulthana T
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
MM Mahindra Morar
- Nov 23, 2017 09:04 PM UTC
- Dec 7, 2017 04:24 AM UTC