Model:
public class Product { public int ProductID { get; set; } public string Name { get; set; } public string ProductNumber { get; set; }
public List<ProductLocations> Locations { get; set; } }
public class ProductLocations { public string Address { get; set; } }
Controller
[GridDataSourceAction] [HttpPost] public ActionResult PostDataMethod3(Product Param1, string Param2, string Param3) { try { List<Product> products = new List<Product>();
products.Add(new Product { ProductID = 1, Name = "Product 1", ProductNumber = "12345" }); products.Add(new Product { ProductID = 2, Name = "Product 2", ProductNumber = "12346" }); products.Add(new Product { ProductID = 3, Name = "Product 3", ProductNumber = "12347" }); products.Add(new Product { ProductID = 4, Name = "Product 4", ProductNumber = "12348" }); products.Add(new Product { ProductID = 5, Name = "Product 5", ProductNumber = "12349" });
return View(products.AsQueryable()); } catch (Exception ex) { string error = ex.Message; return null; } }
AJAX call
var appJson = { "Param1": { "ProductID": 1, "Name": "test product", "ProductNumber": "P123", "Locations": [{ "Address": "Address1" }, { "Address": "Address2" }]}, "Param2": "Param2", "Param3": "Param3" };
$('#postData3').click(function (e) { e.preventDefault();
$.ajax({ url: '@(Url.Action("PostDataMethod3"))', type: 'POST', traditional: true, contentType: "application/json", dataType: "json", data: JSON.stringify(appJson), success: function (response) { alert('Succcess'); $('#grid').igGrid({ dataSource: response }).igGrid("dataBind"); }, error: function (xhr, ajaxOptions, thrownError) { alert('Failure - ' + xhr.responseText); $('#grid').igGrid({ dataSource: null }).igGrid("dataBind"); } }); });
Eroor:
2022infragisticerror.igGridQueryStringToJson.zip
Hello Anitha,
Thank you for answering my questions!
I am currently investigating the cause of this behavior. I will keep you posted on my progress, and I will get back to you soon with more information or questions for you.
Please feel free to continue sending updates to this case at any time.
Regards, Aleksandar Atanasov, Infragistics
Hello Axl Atanasov,
Do you any fix for this.
I am clearing posted my code as previous post given dll , controller, ajax call and view mode which are fine what you need more.
Anyway i am adding here one more time please have a look.
for you questions answer
Are you using the trial dependencies? ( No we have received from infragistics it's paid dll(Infragistics.Web.Mvc, Version=5.22.2.7))
Did you install the dependencies using NuGet or do you run them locally? No i am using paid dll (Infragistics.Web.Mvc, Version=5.22.2.7))
Did you test the previously provided sample and is there an error message when testing it? yes verified the solution you provided not working with Infragistics.Web.Mvc, Version=5.22.2.7 you can also have a try the same solution with Infragistics.Web.Mvc, Version=5.22.2.7. if it's working for you let me.
Infragistics.Web.Mvc, Version=5.22.2.7 I am using
Infragistics.Web.Mvc, Version=5.22.2.7.zip
HTML and Controller as ZIP File
Code.zip
Error screen:
Hello Anitha, In order to ensure that your issue is addressed correctly, I will need some additional information regarding your scenario. Can you please answer the following questions: Are you using the trial dependencies? Did you install the dependencies using NuGet or do you run them locally? Did you test the previously provided sample and is there an error message when testing it? In addition it would be great if you could provide a small, isolated sample demonstrating the issue in order to be able to investigate this further and find the root cause of the behavior. This information is going to be highly appreciated and will help me in my further investigation. Looking forward to hearing from you. Regards, Aleksandar Atanasov, Infragistics
Can you check this as priority