This question is locked. New answers and comments are not allowed.
Ramyashree
Top achievements
Rank 1
Ramyashree
asked on 28 Jan 2011, 07:33 AM
Hi,
Can I set the DataContext of my selected row dynamically in codebehind without altering that of the grid ...?
Thanks and Regds.,
Ramya
Can I set the DataContext of my selected row dynamically in codebehind without altering that of the grid ...?
Thanks and Regds.,
Ramya
3 Answers, 1 is accepted
0
Hello Ramyashree,
The row already has a DataContext and that is the business object.
Can you give us more details about your ultimate goal.
Regards,
Veselin Vasilev
the Telerik team
The row already has a DataContext and that is the business object.
Can you give us more details about your ultimate goal.
Regards,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Ramyashree
Top achievements
Rank 1
answered on 28 Jan 2011, 09:56 AM
Well I have a datagrid that is data bound using a raddomaindatasource.. I have a 'details' button for each of the rows which on clicking opens a child window with the details of the selected row which allows user to edit... Whenever the user clicks on the button cancel in the child window , I want the changes made to be undone...
The code I have written for the required functionality is as follows..
The above code works well mostly... However when new row is added and edited without saving it first, clicking on the cancel button of the child window will delete the newly added row (obviously because of the method RejectChanges()) ...
I thought saving the current item before editing and then setting it as the datacontext of the row (On clicking cancel button of the child window) will solve my problem... However it does not seem to be possible..
Is there any other way the issue can be addressed...?
Thanks and Regds.,
Ramya
The code I have written for the required functionality is as follows..
private void btnDetails_Click(object sender, RoutedEventArgs e) { airport = (Web.Airport)((Button)sender).DataContext; detail = new ChildWindowDetail(airport); detail.Show(); detail.Closed += new EventHandler(detail_Closed); } void detail_Closed(object sender, EventArgs e) { if ((bool)detail.DialogResult == false) { radDomainDataSourceAirports.RejectChanges(); } }I thought saving the current item before editing and then setting it as the datacontext of the row (On clicking cancel button of the child window) will solve my problem... However it does not seem to be possible..
Is there any other way the issue can be addressed...?
Thanks and Regds.,
Ramya
0
Hi Ramyashree,
What is the exact sequence of actions that you do when you insert a new row?
Click on Insert button - fill up some data and then click on the Details button before the data is submitted?
Can't you save the item before invoking the child window?
Regards,
Veselin Vasilev
the Telerik team
What is the exact sequence of actions that you do when you insert a new row?
Click on Insert button - fill up some data and then click on the Details button before the data is submitted?
Can't you save the item before invoking the child window?
Regards,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>