Hi.
I have defined a set of columns that are bound to my BindingList<RowEntry> collection. This works like it should. I am now in the process of adding some extra columns dynamically. How do I populate these? is there a "DidNotFoundPropertyManuallySetCellData" event? :-)
/jorge
I have defined a set of columns that are bound to my BindingList<RowEntry> collection. This works like it should. I am now in the process of adding some extra columns dynamically. How do I populate these? is there a "DidNotFoundPropertyManuallySetCellData" event? :-)
/jorge
6 Answers, 1 is accepted
0
Accepted
Hi Jorge Delgado-Lopez,
Greetings,
Julian Benkov
the Telerik team
When you add a column without setting its FieldName, the column is set in unbound mode and you can directly get/set its cell values:
GridViewTextBoxColumn unboundColumn =
new
GridViewTextBoxColumn();
unboundColumn.Name =
"Unbound"
;
radGridView1.Columns.Add(unboundColumn);
radGridView1.Rows[0].Cells[
"Unbound"
].Value =
"MyValue"
;
Greetings,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

superold
Top achievements
Rank 1
answered on 30 Aug 2010, 01:34 PM
Thanks for the answer. The next question would be where do I populate these columns?
Bind first and loop through rows after? Or should I use some grid event since the columns are not shown by default (IsVisible = false) it would be great if I can populate them when needed.
Thanks
- jorge
Bind first and loop through rows after? Or should I use some grid event since the columns are not shown by default (IsVisible = false) it would be great if I can populate them when needed.
Thanks
- jorge
0
Hello Jorge Delgado-Lopez,
Sincerely yours,
Julian Benkov
the Telerik team
To populate a row in inbound mode you can loop through the rows collection:
foreach
(GridViewDataRowInfo row
in
radGridView1.Rows)
{
row.Cells[
"MyColumn1"
].Value =
"Value1"
;
row.Cells[
"MyColumn2"
].Value =
"Value2"
;
//...
}
Sincerely yours,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

superold
Top achievements
Rank 1
answered on 08 Sep 2010, 01:01 PM
thank you. i noticed that setting the datasource populates the grid.
0

David A.
Top achievements
Rank 1
answered on 09 Jan 2012, 10:44 AM
I have the same scenario with bound and unbound columns but the grid datasource shares a binding context with a popup form that edits the grid data. When I make a change to an unbound column, is there an event with the GridView that will fire to refresh the row in the Grid? I tried the CellFormatting event but I found that this event if not very efficient to populate cells with. I also tried the CellValueNeeded but it did not fire (Virtual Mode only?)
I would like to know 2 things:
I would like to know 2 things:
- In what grid event should unbound data be populated?
- Is there an event that is raised when a row's DataBoundItem has changed?
Thank you.
0
Hello David,
This will automatically refresh the current view of RadGridView control. The updated logic can be processed after you change some part of your data objects or after the end-user interacts with other UI elements in your application. If you want to update the information using RadGridView editing and then sync this unbound values from RadGridView control to an external data object you can use CellValueChanged or RowsChanged events. In bound mode when a DataBoundItem is changed, RadGridView will automatically refresh, if the DataSource object implement IBindingList interface. More information about binding notifications you can find in this article.
I hope this information is useful. Let me know if you need further assistance.
Greetings,
Julian Benkov
the Telerik team
To populate a row in inbound mode you can loop through the rows collection:
foreach
(GridViewDataRowInfo row
in
radGridView1.Rows)
{
row.Cells[
"MyColumn1"
].Value =
"Value1"
;
row.Cells[
"MyColumn2"
].Value =
"Value2"
;
//...
}
This will automatically refresh the current view of RadGridView control. The updated logic can be processed after you change some part of your data objects or after the end-user interacts with other UI elements in your application. If you want to update the information using RadGridView editing and then sync this unbound values from RadGridView control to an external data object you can use CellValueChanged or RowsChanged events. In bound mode when a DataBoundItem is changed, RadGridView will automatically refresh, if the DataSource object implement IBindingList interface. More information about binding notifications you can find in this article.
I hope this information is useful. Let me know if you need further assistance.
Greetings,
Julian Benkov
the Telerik team
SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).