I was using RadGridView in which i want to fetch data from XML and also need to add custom column Checkbox to enable/disable the row.
Using Winforms, WPF Telerik RadControls
1 Answer, 1 is accepted
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Sep 2014, 04:45 PM
Hello Bindu,
Thank you for writing.
Binding to XML is not directly supported by RadGridView but DataTables are supported and a DataSet (containing DataTables) can be created from an XML document. Please refer to our GridView >> Bind to XML help article which demonstrates how to load xml data in RadGridView. Additionally, you can add as many columns as you wish via the RadGridView.Columns collection. Thus, you can add GridViewCheckBoxColumn and disable/enable all the cells on the current row, except the current one. Here is a sample code snippet, demonstrating how to achieve it by using the RadGridView.ValueChanged event and the RadGridView.CellFormatting event:
if (e.Row is GridViewDataRowInfo && e.Row.Cells["Checked"].Value!=null)
{
var isChecked = e.Row.Cells["Checked"].Value ;
if ((isChecked ==null ||(bool)isChecked==false)&& e.CellElement.ColumnInfo.Name!= "Checked")
{
e.CellElement.Enabled = false;
}
else
{
e.CellElement.Enabled = true;
}
}
}
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.