We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Filtering and Dropdown in grid with key = Guid

Thread ID:

Created:

Updated:

Platform:

Replies:

124848 Jul 4,2016 07:48 AM Jul 5,2016 09:23 AM ASP.NET MVC 1
loading
Tags: Grid
Eddy Tick
Asked On July 4, 2016 07:48 AM

When using a childgrid with the usage of Guid in Grid and ChildGrid the functions do not work as expected.

Child grid data functionn 

DataManager dataManager;
DataOperations operation = new DataOperations();

// this has to be done else a conversion error occures.
dataManager.Where[0].value = Guid.Parse(dataManager.Where[0].value.ToString());

data = operation.PerformWhereFilter(data, dataManager.Where, dataManager.Where[0].Operator);

Also a problem with a dropdown in the grid with Guid as ForeignKey. It does not show the dropdown list and the value (same issue???)

The data delivered is a guid and not a string.

Karthick Kuppusamy [Syncfusion]
Replied On July 5, 2016 09:23 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;