The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
My project's requirements say that we should allow users to enter incorrect information in GGC cells, and validate them when the user tries to save. I have a date column (the underlying datatype is DateTime), and it uses the MonthCalendar control to choose dates. It is, however, possible for the user to enter something like "abc" in this date field by hand. The problem is that when the user leaves the cell the GGC immediately pops up a message box saying that "abc is an invalid value for System.Date", highlights the row, puts an error icon on the cell and doesn't let the user exit the cell.
My question is, is it possible for me to: a) Keep the underlying column as DateTime, but: b) Turn off all of the normal validating behaviour and allow the user to leave the incorrect cell, while keeping the incorrect data in the cell.
The closest I've come so far, with various combinations of TableControlCurrentCellValidating, SaveCellFormattedText, etc. is that no exceptions are thrown and no error icon or message show up, but then the invalid cell value gets blanked out. I accomplish by having this line: this.gridGroupingControl1.TableDescriptor.Columns["MonthCalendarAdv"].Appearance.AnyRecordFieldCell.CellValueType = typeof(System.String);
So, is there actually any way to accomplish what I'm trying to do?
ADAdministrator Syncfusion Team November 13, 2006 12:33 PM UTC
Hi Michael,
The best way to do this would be to have an extra column in your DataTable say ‘HideMonthCalenderAdv’ to keep track of the MonthCalender cell invalid entries. You can handle the QueryCellFormattedText event to set the DisplayText of the MonthCalenderAdv from HideMonthCalenderAdv entries. Please refer this sample for the implementation
Thanks for the example - a little tweaking gave me what I was looking for (the example doesn't update the date when you click on a date in the dropdown calendar).
Not quite sure why this works, since I'm only getting the value and then setting it to what I just got, but this way the date updates immediately after a click on the calendar.
Thanks, Michael
ADAdministrator Syncfusion Team November 17, 2006 06:34 AM UTC
Hi Michael,
You can handle the TableControlCurrentCellCloseDropDown event and set the Renderer.ControlText property to DropDown value. Here is a code snippet to show this.
private void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e) { GridCurrentCell cc = e.TableControl.CurrentCell; if( cc.ColIndex == 5) { GridTableCellStyleInfo style = cc.Renderer.CurrentStyle as GridTableCellStyleInfo; Element el = style.TableCellIdentity.DisplayElement; GridRecordRow grecrow = el as GridRecordRow;