Can't make cells with Controls (built-in) StyleInfo set display when clicked

Using Windows Forms controls set 16.14.60.24, I can't make ControlGrid cells have expected click behavior when set to MonthCalendar or ComboBox CellType, for example. I must be missing something simple, but even though I've tried the example code and various variations on them, I still get the same result: No controls pop up when the grid cell is clicked. My GridControl show that the display is doing expected things, but that's about it. Also, the Format setting for the cell also has no effect. (The date string in my code is displayed as a long date format (with HH:mm:ss etc.)) Here is some example C# code from my project:
// testing values:
int colDOB = 6; // an int for the column.
int i = 1; // an int for the row.
// grid is GridControl


GridStyleInfo monthCalendar = new GridStyleInfo();
monthCalendar.CellType = GridCellTypeName.MonthCalendar;
monthCalendar.CellValueType = typeof(System.DateTime);
monthCalendar.Format = "MM/dd/yyyy";

grid[i, colDOB].CellType = GridCellTypeName.MonthCalendar;
// a simple date for testing:
string cellDate = "02/12/2000"; // a test value.
DateTime dT;
if (DateTime.TryParse(cellDate, out dT))
{
monthCalendar.CellValue = dT;
}
else
{
monthCalendar.CellValue = DateTime.MinValue;
}
grid[i, colDOB] = monthCalendar;
// same behavior if next line omitted:
grid.ChangeCells(GridRangeInfo.Cells(i, colDOB, i, colDOB),new GridStyleInfo[] { monthCalendar }, Syncfusion.Styles.StyleModifyType.Override);
Anything look odd here?
Bob

3 Replies

SN Sindhu Nagarajan Syncfusion Team March 21, 2018 11:45 AM UTC

Hi Robert, 

Thanks for contacting Syncfusion support. 

We have analyzed your code part and created the simple sample as per the given code snippet. But unfortunately, we could not able to reproduce your reported scenario at our end. Please refer to the attached sample,video file and confirm us whether the reported issue is occurred in the attached sample or not and let us know if we missed anything from your scenario. 



Moreover, you can customize the cell text format and cell type in QueryCellInfo event. Please make use of the below code. 

Code Example 
gridControl1.QueryCellInfo += GridControl1_QueryCellInfo; 
 
private void GridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) 
{ 
   if(e.ColIndex==3 && e.RowIndex>0) 
     { 
         e.Style.CellType = GridCellTypeName.MonthCalendar; 
         e.Style.CellValue = "12/23/2000"; 
         e.Style.Format = "dd/MM"; 
     } 
} 


Regards, 
Sindhu  



RD Robert Dickow March 21, 2018 07:17 PM UTC

Thanks for the hints. I got it all to work, and it was simpler than I thought. The problem was that I was adding explicit cell styles to my cells after I already had the cells set in the QueryCellInfo event callback. But just a few settings on the QueryCellInfo event params objects-- as your example suggests-- did the trick much more efficiently.  -- Bob


SN Sindhu Nagarajan Syncfusion Team March 22, 2018 05:19 AM UTC

Hi Robert, 
  
Thanks for the update. 
  
We are glad to hear that the provided solution resolved your scenario. Please let us know if you have any other queries. 
  
Regards,  
Sindhu  


Loader.
Up arrow icon