We have an issue during development regarding the igGrid.
Whenever we are doing a post from a form and we want to take the user to the same page and reload again the grid the below error shows.
the code is: @(Html.Infragistics().Grid(Model.Rolegrid))
from the backend is a normal basic creation of a grid with custom columns etc.
This only happens on Post and never on get.
If you need more information just ask and will provide.
To provide a sample application will be difficult but if needed I will try to send a sample code
Hello Luke,
Thank you for posting in our forum.
There is another forum thread that was started three weeks ago, where the same issue is discussed – you may read my reply there and try using the JSON validators that I suggested in my reply there.
The other user was getting the same error, but was only able to provide a part of his grid initialization configuration, which in that scenario is not enough to reproduce the problem. Hence I would really appreciate if you please provide an isolated MVC code sample where not only the grid, but the form creating the POST request is present as well. That would allow me reproduce this behavior on my side, debug and find what is causing the issue so I could give you a more detailed answer.
I look forward to hearing from you.
Hi vasil
I'm replying on behalf of my colleague who posted the issue as for some reason he can't reply to the post.
I have attached the link to a sample code made with our libraries and scripts used. from the Home page there is a post button which doesn't transfer anything but refreshes the grid view for the Post.
For some reason on the build of the page it returns an error mentioned above
can you investigate the issue as this was not present on the 2018 Infragistics, but is present in the 2019 version
We transfer link
Hello Marcia,
After further testing of your sample, I have opened a development issue with an ID: 264960. In order to follow the progress of this issue I've also created a private case for you, with an ID: CAS-202997-B9C2N5.
You can find the case by going to your account on our web site, and then to the "Support activity" tab.
Also, you can view the status of the development issue connected to that case by selecting the "Development Issues" tab when viewing this case.
Please let me know if you have some further questions.
Hello Vasil,
is there any solution coming or any workaround?
Kind regards,
Bart
Hello Bartholomaeus,
The issue is currently fixed and verified internally by our Engineering Team. It will be available into the next service release versions. You can check out the release schedule here.
If you are unable to wait, please create a separate ticket in our support system and let us know that you want to receive the next available bi-weekly build containing the fix.
Hello Deyan,
thank you for the information.
Now it is nearly one year later and I tried again tu upgrade my project vom 17.2 to the latest 20.1
but I have still the same problem :-(
I figured out the source of the issue:
- using a POST-Request
- you have an integer array in your payload
--> it does not matter how your GridModel looks like.
In GridModel.DataBind() the payload of the request is somehow parsed and that fails.
Example:
Payload from the POST-Request
{"fromDate":"2020-07-15T14:05:59.420Z","tillDate":"2020-07-15T14:05:59.427Z","mandantIds":[13],"filterDisplayText":"15.07.2020 - 15.07.2020 IMPULS KÜCHEN GMBH - 59916 BRILON","reportId":1}
Error-msg:
Unexpected character encountered while parsing value: [. Path 'mandantIds', line 1, position 91.
Position 91 is exact the where first bracket starts [13]
For this Example I have changed my GridModel to something simple:
public static GridModel getGridModel(ControllingReport report, ReportRequestObject request) { GridModel gridModel = new GridModel(); gridModel.Height = "100%"; gridModel.Columns.Add(new GridColumn("Product Name", "Name", "string", "300px")); gridModel.DataSource = new List<string>{"1", "2" }; return gridModel; }
Please investigate again in this issue.
Thank you and kind regards
Karol
Hello to all,
I've found out the reason for the issue in your source code.
In GridModel.DataBindInternal()
// extracting parameters for POST requests if (HttpContext.Current != null && HttpContext.Current.Request.HttpMethod == "POST") { Stream req = this.HtmlHelper != null ? this.HtmlHelper.ViewContext.HttpContext.Request.InputStream : HttpContext.Current.Request.InputStream; req.Seek(0, SeekOrigin.Begin); string json = new StreamReader(req).ReadToEnd(); if ((json.StartsWith("{") && json.EndsWith("}")) || (json.StartsWith("[") && json.EndsWith("]"))) { var dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(json); if (dict != null) { queryString = dict.Aggregate(new NameValueCollection(queryString), (seed, current) => { seed.Add(current.Key, current.Value); return seed; }); } } }
This line excpects that the whole payload is only a key/val pair of strings ¯\(°_o)/¯
var dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
But i need to consume complex types in my middleware that I pass with the POST-Payload