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

IGridEditableColumn

3 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kyle Jones
Top achievements
Rank 1
Kyle Jones asked on 13 Aug 2009, 08:58 PM
Hey,

I have a RadGrid on my page and I am trying to access the information that I am editting and I am having a problem with the TemplateColumn.  This is the code that I am using to traverse through a Grid that is all text and it works great but when I try to edit it to work on Template Columns I keep getting that the column is null when it has Data in it.  Just so you know that when I am using a TemplateColumn I have a RadComboBox inside it and that is what I am trying to grab the information from when i am updating or inserting.  I am making the change to make the editor be a RadComboBox but it is still giving me null values when there is data in my ComboBox.

foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
{
if (column is IGridEditableColumn)
{
IGridEditableColumn editableCol = (column as IGridEditableColumn);
if (editableCol.IsEditable)
{
IGridColumnEditor editor = editManager.GetColumnEditor(editableCol);
if (editor is GridTextColumnEditor)
{
if (Decimal.Parse((editor as GridTextColumnEditor).Text) > 0)
{
offerValues[i] = Decimal.Parse((editor as GridTextColumnEditor).Text);
i++;
}
else
{
status = false;
}
}
}
}
}

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 14 Aug 2009, 05:58 AM
Hello Kyle,

Could you provide more information on your scenario. What event do you traverse the columns in and what exactly is the purpose of accessing the information in the columns.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kyle Jones
Top achievements
Rank 1
answered on 14 Aug 2009, 01:05 PM
No Problem.  What I am trying to do is I have a grid that has some data in it and I am letting users edit that data that is in the columns.  The code that I provided I am using on a different page for the same reason but it just has textboxes.  This time around my gird has two template columns that have radcomboboxes in them that users are still allowed to change to information in and I have 2 gridbound with the standard text box that comes with it and 2 numericcolumns.  So I have 5 columns that can be edited and I am trying to figure out how to re-write the code that I provided so that I can grab the information off the grid and update my database when someone changes the information and wants it saved.
0
Tsvetoslav
Telerik team
answered on 19 Aug 2009, 11:07 AM
Hello Kyle,

Do you put the rows you need to update in EditMode? If so, you can attach an event handler to the UpdateCommand event and extract the information through ExtractValue method of the coming event-args object Item property (you need to cast e.Item to GridEditableItem or GridEditFormItem).

If you have any other custom logic of updating the records, you need to traverse the rows  - the grid's Items collection, and not the columns. How exactly you should manipulate the latter depends on your particular scenario.

I hope this information helps.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Kyle Jones
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Kyle Jones
Top achievements
Rank 1
Share this question
or