Dear Telerik,
I've got a RadGrid, which has been filled with data from EntityDataSource - perfect. First column contains a GridEditCommandColumn, which fires correctly and display a FormTemplate with plenty of TextBoxes, FormTemplate contains also w RadButton with CommandName="Update" (and Cancel) - data updating works perfecty.
One of bound columns is a "Status_ID" column, which is related to another table (MSSQL). Statuses are displayed (inside FormTemplate) with RadTreeView control - also works perfectly. Unfortunately I could not find any solution for "automagical" binding "SelectedValue" of RadTreeView control with some of "Bind(column)" expression, so I've used the "NodeDataBound" event and if node.Value equals my Status_ID I select it.
Unfortunately the problem is, when I'd like to change another node from RadTreeView and fire data updating. Now I'm using such method (just after NodeClick)
Which works, but it's ugly - when I update textboxes AND i update RadTreeView just after and I submit, the textboxes-changes are ignored where status is updated correctly - but it's obvious with my solution.
What would be nice:
1. When node click - update an entity object which is used by FormTemplate (not the new one).
- Maybe I should update data by accessing the (EditItems[0] as GridDataItem).DataItem as MyEntity)? Will it work?
2. On CommandName="Update" fired, all controls might be successfully updated - am I right?
Thank you for ur time & help ;)
All the best,
Przemek M. Zawada
I've got a RadGrid, which has been filled with data from EntityDataSource - perfect. First column contains a GridEditCommandColumn, which fires correctly and display a FormTemplate with plenty of TextBoxes, FormTemplate contains also w RadButton with CommandName="Update" (and Cancel) - data updating works perfecty.
One of bound columns is a "Status_ID" column, which is related to another table (MSSQL). Statuses are displayed (inside FormTemplate) with RadTreeView control - also works perfectly. Unfortunately I could not find any solution for "automagical" binding "SelectedValue" of RadTreeView control with some of "Bind(column)" expression, so I've used the "NodeDataBound" event and if node.Value equals my Status_ID I select it.
Unfortunately the problem is, when I'd like to change another node from RadTreeView and fire data updating. Now I'm using such method (just after NodeClick)
var n = (e.Node);
int
selectedStatus =
int
.Parse(e.Node.Value.ToString());
if
(Respondent_Current ==
null
)
{
int
respondentId =
int
.Parse((
this
.RadGrid_Respondent.EditItems[0]
as
GridDataItem).GetDataKeyValue(
"ID"
).ToString());
Respondent_Current = Csi_Entities.PB_Respondent.Where(i => i.ID.Equals(respondentId)).First();
}
if
(Respondent_Current !=
null
)
{
Respondent_Current.Status_ID = selectedStatus;
this
.Csi_Entities.SaveChanges();
this
.RadGrid_Respondent.Rebind();
}
else
{
//Crap }
Which works, but it's ugly - when I update textboxes AND i update RadTreeView just after and I submit, the textboxes-changes are ignored where status is updated correctly - but it's obvious with my solution.
What would be nice:
1. When node click - update an entity object which is used by FormTemplate (not the new one).
- Maybe I should update data by accessing the (EditItems[0] as GridDataItem).DataItem as MyEntity)? Will it work?
2. On CommandName="Update" fired, all controls might be successfully updated - am I right?
Thank you for ur time & help ;)
All the best,
Przemek M. Zawada