I have a WebdataGrid, 11.2, and I am trying to use an WebDateTimeEditorProvider on two columns out of many. The number of columns is not know at design time so I am generating everything at runtime. It is all working correctly except that when I click on my date columns, which are columns 2 and 3, the editor appears in column 1.
I am basically follwong the example shown in this link except that I am using a DateTimeEditior instead of a Date picker:
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.2/CLR4.0/html/WebDataGrid_Using_Editor_Providers.html
Also, other columns that should not have an editir asociated with them also have an editor displayed just below the cell whenever they are put into edit mode. I woudl like those cells to be edited within the cell without any editor.
Any help would be appreciated.
Hello wamanring,
Thank you for posting in our community. When you have your columns set to be auto generated and you cannot be sure how many columns you will have I will recommend you to use the following approach to create the Editor provider. Handle the DataBound event of the grid and in the body of the method implement the following:
void WebDataGrid_DataBound(object sender, EventArgs e)
{
// Enable cell editing
this.WebDataGrid.Behaviors.CreateBehavior<EditingCore>();
this.WebDataGrid.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>();
// Create an editor provider
DateTimeEditorProvider datePickerProvider = new DateTimeEditorProvider();
datePickerProvider.ID = "DatePickerProvider1";
// Add to collection
this.WebDataGrid.EditorProviders.Add(datePickerProvider);
// Create a column setting to use the editor provider
EditingColumnSetting columnSetting = new EditingColumnSetting();
columnSetting.ColumnKey = "Item";
// Assign editor for column to use
columnSetting.EditorID = datePickerProvider.ID;
// Add column setting
this.WebDataGrid.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(columnSetting);
}
Note that this columnSetting.ColumnKey = "Item"; sets the editor to a column with a specific ColumnKey – Item.
I hope this sample code helps.
For any further questions with this matter do not hesitate to contact me.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
This approach worked - thank you.