Telerik WPF RadGridView CellEditEnded event issue - c#

I am using Telerik RadGridView for WPF to display the data.
My requirement is when I end up changing a value in one of the columns then update the data of different columns of same row.
I am using CellEditEnded event to calculate and update other cell's value.
This works when I set the focus to any other cell of different row but if I click somewhere in the cells of same row, it does not update values.

Found the solution. Just added grid.Items.CommitEdit().

Related

break in refreshing my custom combo box column in RadGridView

I have created a custom grid column for a RadGridview which based on the row DataItem which is a class, finds the corresponding items and put them in the Combobox.
When the page loads, the custom column is freeing to be created only for the rows that are in visual and for other rows, it has been fired to be created when the user scrolls down. Unfortunately, when the user scroll the wrong combo boxes are created for each row.
For example, run the below sample and see the combobox in front of dimensionless row, which must be empty which is correct. Now scroll down and click on a cell and scroll up to the dimension row, which now have a Combobox with values which is erroneous. Note that the dimensions combo box is shifted up now!
Why the combo boxes are wrong after scrolling or windows size change?
It is Virtualization which is causing the behaviour you describe.
You can disable this on a RadGridView like so:
EnableRowVirtualization="False"
This will cause all your data to load whether it's in view or not, and if you have a lot of data this can cause significant performance issues.

WPF c# DataGrid value changes are not notified cell by cell

I have a datagrid with data bound with an Observable collection of objects which implement InotifyChanged. When i select an item in the data grid, the selection unit should be the entire row (not cell by cell). However, when i update a cell and navigates to the other cell using the "tab" key, the change on the previous cell should be saved (or the PropertyChangedEvents should be triggered). Is there a way to achieve this?
Additional notes:
I've tried with UpdateSourceTrigger=LostFocus and this works fine. But once the change is saved, the current cell is not highlighted (editable). I had to click on the cell again using the mouse to get the focus.
I tried to use the SelectionCellsChanged event but this is not triggered while navigating through cells when the selectionMode is row

Equivalent for DataGrid RowDetails template in Winforms DatagridView

I need to create an expander in my datagridview that adds additional info about that row to the datagridview when selected, and hides the same when collapsed.
This is possible by creating RowDetails templates in WPF, but can I do something similar in winforms datagridview? A workaround I'd thought of was dynamically adding objects to the datagridview on expand/collapse, but it won't work in this case because the number, type, arrangement of columns is very different for the details rows than the data rows.
Can RowTemplate possibly help? All examples I've seen thus far use rowtemplate only to fix height, width etc of rows in a datagridview and nothing else.
You can use ToolTip for selected row if you want to show additional data info.

about repositoryItemCheckEdit

I've added repositoryItemCheckEdit in a xtragrid control's column. And i'm having total 3 columns in my xtragridview. From which two columns will be filled with the help of fields from my table when i'm setting datasource property of gridcontrol.
problem which is i'm facing is that when i'm changing the status of checkbox from xtragrid to checked for one time it works but when i'm checking from next row that time the previous selection of checkbox from gridview lost. It only maintain for only one row. and i want it two remain for multiple row.
how to do this?
my datatable contains two fields as TemplateTitle & TemplateBody. And my xtragrid contains three columns as two from datatable & additional column as a repositoryItemCheckEdit which is unbound column. I created columns of gridview at design time. and i've set just datasource property of gridcontrol to datatable.
thanks.
If the repositoryItemCheckEdit is unbound you have to control the CheckEdit's checked state manually using the grid's CustomUnboundColumnData event otherwise the state is lost when you move to a different row.
You must search DevExpress support center for these type of issues. These are pretty well documented and can be found easily there.
http://www.devexpress.com/Support/Center/p/B135631.aspx
http://www.devexpress.com/Support/Center/p/Q254784.aspx
Using BindingList and not DataTable or ObservableCollection solves the problem for booleans bound to a checkbox in a (DevExpress) GridView/GridControl ( Windows Forms ).

edit datagrid row

i want to know how to edit a single row (which i select) from a data grid
for example i have a datagrid with columns A, B and C
and i have a couple rows of data, approx 10 rows.
lets say i want to change the value of data within row 4.
how would i do this?
i am using visual studio 2003, but i guess if visual studio 2005 would be okay too. for the coding I'm using c#
thanks..
All grid-like components of asp.net have the same machanism as it comes to starting to edit a single row. Actually it's default for asp.net only to edit a single row in a grid.
Needed to start editing is to include asp:button or asp:linkbutton in the ItemTemplate with the CommandName set to "Edit". This one of reserved commandnames all grid-like components knows how to respond to. Clicking this button in DataGrid will raise the EditCommand Event. In this event you have to set the EditItemIndex of the grid equal to Item.Itemindex of the eventargs. This will render the row vaccordeing to the EditItemTemplate.
In this template you put 2 buttons or linkbuttons. One should have the CommandName set to "Update" and one should have the CommandName set to "Cancel".
The "Update" button raises the UpdateCommand event. In which you execute code that store the data in the row to its storage (eg.: database) and sets the EditItemIndex to -1 --> all rows are rendered read-only(ItemTemplate or AlternateItemTemplate).
The "Cancel" button raises the CancelCommand event. In the event handler you have to do si set the EditItemIndex to -1.
This description is only true for DataGrid en not for the in asp.net introduced GridView which handles most of this "Boilerplate"code it self working together with the datasource controls. Google the web for more info on this. it's to much to explain here right now.
Hope it helps?
Take a look at the documentation for adding an EditItemTemplate to your datagrid. You use the ItemTemplate for view-only, display elements and you use the EditItemTemplate for controls used to bind against a single row that you select.
Here's a link that might help:
http://www.gridviewguy.com/
Is your data in a DataTable before making it a DataGrid, or can you put it in a DataTable? You can update/delete/edit rows in a DataTable, here's a link with code snippets, pretty straight forward:
http://msdn.microsoft.com/en-us/library/tat996zc(VS.80).aspx

Categories

Resources