Hi Eddy,
Query 1: This has to be done else a conversion error occurs.
We have analyzed your code example and we are able to reproduce the reported issue. Normally when using a GUID column it will serialize the value as string while returning the data from controller to view. So that you have faced an exception while binding the data. To overcome this please use the same code that you have used to convert string value to Guid.
Please refer the below example
[controller.cs]
DataOperations operation = new DataOperations();
if (dm.Where != null && dm.Where.Count > 0) //Filtering
{
dm.Where[0].value = Guid.Parse(dm.Where[0].value.ToString());
data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator);
}
int count = data.Cast<Child>().Count();
return Json(new { result = data, count = count },JsonRequestBehavior.AllowGet); |
Query 2: Also a problem with a dropdown in the grid with Guid as ForeignKey
We are not able to reproduce the reported issue. We have checked by binding the ForeignKey value to the guid column in childgrid. The data bind to the dropdown list and the value are rendered correctly. Please refer the below code example
[GridFeatures.cshtml]
.ChildGrid(child =>
{
…
.Columns(col =>
{
col.Field("guid").HeaderText("guid").ForeignKeyField("guid").ForeignKeyValue("customer").DataSource((IEnumerable<object>)ViewBag.datasource1).EditType(EditingType.Dropdown).TextAlign(TextAlign.Left).Width(90).Add();
…
}) |
If you still face the issue please get back to us with the following details,
1. Have you used any adaptor for child grid and parent grid to bind the data?
2. In which column for childgrid you have bind a ForeignKey?
3. Is there any script error or exception thrown in your project for not binding the datasource for dropdown control? If so, attach a screenshot for your stack trace.
4. Share the video to show the issue.
5. Issue replication procedure.
6. An issue reproducing sample if possible or replicate the issue in the following sample
7. Share the grid rendering code and server side code
We have also prepared a sample that can be downloaded from the below link,
The provided information will help us to analyze the issue and provide you the response as early as possible.
Regards,
K.Karthick.