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 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
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 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 Vasil,
is there any solution coming or any workaround?
Kind regards,
Bart
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.