This is a migrated thread and some comments may be shown as answers.

override CommitEdit to change type

2 Answers 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 30 Sep 2011, 06:35 PM
Hi again, another radGridView question for the experts :)

I have a radGridView that has itemsource bound to a datatable, and I have xaml & code that successfully performs a cell editing template swap based on certain events.  The columns are automatically generated, and the two-way-bound datasource is all text fields. The cell editing templates are either text, or datetime (if the datetime template is turned on, then that cell uses a radDateTimeView object).

Everything works great, except that when the radDateTime templated cells go to commitEdit, nothing in the itemSource gets updated, I beleive do to the types being incorrect.

What I would like to do, is go ahead and override the telerik CommitEdit() function, to make the data selected in the radGridView object match the allowable types in the itemsource of the datagrid, namely making it text not a date object at this point, and then call your telerik commit edit afterwords. For whatever reason, visual studio is not recognizing 'base.CommitEdit' or properly overriding it, is there any examples of overridign this function and also would you recommend a different approach to converting this data?

Thanks again.

-Chris

2 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 30 Sep 2011, 06:38 PM
correction, the datasource is a DataTable - not text only, and it sucessfuly adds a date object, just the object is empty and unreflective of the users selection. I would like to override the commitedit though, so i can see whats going on and hopefully correct the values that are about to be inserted or updated in the source.
0
Chris
Top achievements
Rank 1
answered on 30 Sep 2011, 07:16 PM
Disregard - I found an easier solution that using override on commit edit.

In the cell validation event, since the cell is using radDatetime object as part of the template, we have access to EditingElement.EndTime (and other properties of the radDateTime), so I just created a string to be used in my datatable based on the value of these properties.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Share this question
or