How can I determine the grids row type when editing new or existing rows.
I was using grid.itemsource.getType which returns the collection
But if there is no data in the grid it doesn't seem to have a collection but just a single entry.
What the best way to determine the grids type under all code situations.
Thanks
Jim
I was using grid.itemsource.getType which returns the collection
But if there is no data in the grid it doesn't seem to have a collection but just a single entry.
What the best way to determine the grids type under all code situations.
Thanks
Jim
4 Answers, 1 is accepted
0
Hello Jim ,
Typically in the event args you will have the sender visual and or the e.original source.
Having the sender element you can easily get the parent row and check its type .
However there is no unified approach for "all code situations". I can give a specific assistance for a specific case if needed . What exactly you are trying to achieve ?
Greetings,
Pavel Pavlov
the Telerik team
Typically in the event args you will have the sender visual and or the e.original source.
Having the sender element you can easily get the parent row and check its type .
However there is no unified approach for "all code situations". I can give a specific assistance for a specific case if needed . What exactly you are trying to achieve ?
Greetings,
Pavel Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Jim
Top achievements
Rank 1
answered on 09 Jan 2012, 04:40 PM
I have a service which validates a cells contents.
When the service returns if has the grids name but not the rowType
So it can get a reference to the grid with
I am trying to validate both
1) Cells in existing rows
2) Cells in new row ( ie Click here to add new row ) in a grid with existing rows.
3) Cells in new row ( ie Click here to add new row ) in a grid with no existing rows.
Thanks
Jim
When the service returns if has the grids name but not the rowType
So it can get a reference to the grid with
Dim
radGridView As RadGridView = LayoutRoot.FindName(gridName)
I am trying to validate both
1) Cells in existing rows
2) Cells in new row ( ie Click here to add new row ) in a grid with existing rows.
3) Cells in new row ( ie Click here to add new row ) in a grid with no existing rows.
Thanks
Jim
0
Jim
Top achievements
Rank 1
answered on 10 Jan 2012, 08:44 AM
A bit more info.
Typically our grids contain columns of abbreviations and a column of descriptions
It might be cities e.g.
| City | Description |
+------+---------------+
| LON | London UK |
| BER | Berlin DE |
| PAR | Paris FR |
When editing a row , be it existing or new when we enter say "LON" in the first cell and the cell validates on "tab out" then the validation routine fires off a request to the server. When the server "eventually" returns the event handling routine has the grid name and column name and row index. The row index is a problem as it is sometimes -1 ( usually on insert ).
Either LON was found with it's description in this case the description cell is updated ( in the model data ).
If not found then a validation error is inserted into the model data and the Description set to blank.
This approach works with the assumption that -1 is the last entry in the model.
However when inserting a new row into a blank grid we have discovered problems determing the row type.
Hope this helps ...
Jim
Typically our grids contain columns of abbreviations and a column of descriptions
It might be cities e.g.
| City | Description |
+------+---------------+
| LON | London UK |
| BER | Berlin DE |
| PAR | Paris FR |
When editing a row , be it existing or new when we enter say "LON" in the first cell and the cell validates on "tab out" then the validation routine fires off a request to the server. When the server "eventually" returns the event handling routine has the grid name and column name and row index. The row index is a problem as it is sometimes -1 ( usually on insert ).
Either LON was found with it's description in this case the description cell is updated ( in the model data ).
If not found then a validation error is inserted into the model data and the Description set to blank.
This approach works with the assumption that -1 is the last entry in the model.
However when inserting a new row into a blank grid we have discovered problems determing the row type.
Hope this helps ...
Jim
0
Hi Jim,
Nedyalko Nikolov
the Telerik team
Generally you could get the underlying item type from row.Item.GetType(). An instance of a row you can get within RadGridView.RowEditEnded event handler as e.Row.
If this does not help could you please provide me with a little bit more information about your scenario and your requirements?
Nedyalko Nikolov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>