Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello please i'm working on RadGridView(telrik) named "dataGrid" and in the first column i added a checkbox via datatemplate

<pre lang="c#">Telerik.Windows.Controls.GridViewDataColumn col = new Telerik.Windows.Controls.GridViewDataColumn();
                FrameworkElementFactory checkBox = new FrameworkElementFactory(typeof(CheckBox));
                checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("Checkedcolumn"));
                DataTemplate template = new DataTemplate() { VisualTree = checkBox };
                template.Seal();
                col.CellTemplate = template; 
                dataGrid.Columns.Add(col);


and it work and i have collection of some items as the datagrid :in the following code
C#
public ObservableCollection<T> SelectedData { get { return _selectedData; } set { _selectedData = value; } }

i want to check in datagrid the items which are existant in the SelectedData collection i tried this code and the Dataset is the collection that i bind it to my dataGrid
C#
foreach(T item in SelectedData)
            {
                
                for (int i = 0; i < Dataset.Count;i++ )
                {
                   
                    if ((int)Dataset[i].GetPropertyValue("Id") == (int)item.GetPropertyValue("Id"))
                    {
                     
                        foreach (DataGridViewRow row in dataGrid.Items)
                      {
                         
                          ((DataGridViewCheckBoxCell)row.Cells[0]).Value = true;
                      }

                    }
                }
            }
but it doesnt work i tried with DatagridItem type like this foreach (DatagridItem row in dataGrid.Items) but DatagridItem give me "can not be found" error even System.Web.UI.WebControls give me "UI doesn't exist in Sstem.Web" error please help me because almost of solution on the web use Rows and Cells which are not avalable with RadGridview (i men telerik DataGrid)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900