This is a migrated thread and some comments may be shown as answers.

Raddropdownbutton multi select checkbox column

2 Answers 246 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
dev
Top achievements
Rank 1
dev asked on 18 Nov 2010, 12:32 PM
HI,
 
could you please give some more explanantion about your previous reply....am new to telerik  . i have created and  loaded the  raddropdownbutton with checkbox columns, i have written code as below
 
 public partial class DropDownButton : Telerik.WinControls.UI.RadForm
    {
 
        RadGridView grid;
        RadHostItem hostItem;
        string str = string.Empty;
        Workaround.childtemplate.GridMenuItem item = new Workaround.childtemplate.GridMenuItem();
        public DropDownButton()
        {
            InitializeComponent();
        }
 
        private void DropDownButton_Load(object sender, EventArgs e)
        {
 
            SqlConnection con = new SqlConnection("Data Source=ISDTP0026;Initial Catalog=LibraryManagement;Integrated Security=True");
            con.Open();
            DataSet ds = new DataSet();
            SqlDataAdapter adp = new SqlDataAdapter("select CallNumber,Author from Books", con);
            adp.Fill(ds);
            item.Grid.DataSource = ds.Tables[0].DefaultView;
            
           
            GridViewCheckBoxColumn chk = new GridViewCheckBoxColumn();
            chk.DataType = typeof(bool);
            chk.HeaderText = "";
            chk.ReadOnly = false;
            item.Grid.Columns.Insert(0, chk);
            item.Grid.Columns[0].HeaderText = "Select";
            item.Grid.Columns[1].ReadOnly = true;
            item.Grid.Columns[2].ReadOnly = true;
            item.Grid.ReadOnly = false;
            item.Grid.ShowGroupPanel = false;
            item.Grid.AutoSizeRows = true;
            item.Grid.SelectionMode = GridViewSelectionMode.FullRowSelect;
            item.Grid.MultiSelect = true;
            item.Grid.SelectionMode = GridViewSelectionMode.FullRowSelect;
            item.Grid.MultiSelect = true;
            item.Grid.MasterGridViewTemplate.AllowAddNewRow = false;
            item.Grid.MasterGridViewTemplate.AllowDeleteRow = false;
            item.Grid.MasterGridViewTemplate.AllowEditRow = true;
            item.Grid.MasterGridViewTemplate.ShowRowHeaderColumn = false;
            item.Grid.MasterGridViewTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
            item.Grid.MasterGridViewTemplate.BestFitColumns();
            item.Grid.Size = new Size(400, 300);
            radDropDownButton1.Items.Add(item);
}
 
        private void radDropDownButton1_DropDownClosed(object sender, EventArgs e)
        {
// here only i need to store the selected value
 foreach (GridViewRowInfo rowInfo in item.Grid.Rows)
            {
          
            for (int row = 0; row < item.Grid.Rows.Count; row++)
            {
                if (item.Grid.Rows[row].IsSelected)
            {
      
                 string str = item.Grid.Rows[row].Cells[0].Value.ToString();
   
         }
}
}
while dropdown closed event , how to get the selected rows and values....???
 
Please guide me it very urgent.... thanks in advance...
 
Thanks
Dev.
            

2 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 18 Nov 2010, 12:49 PM
Hello,

I'm not sure what your previous communications have been, but I'd like to confirm what you would like to do.
From the look of it, you want to find all rows in a RadGridView that have a checkbox column that are checked.

Is that correct?
Thanks
Richard
0
dev
Top achievements
Rank 1
answered on 19 Nov 2010, 07:32 AM
HI Richard,
                  Thanks for your reply... from the following link
 http://www.telerik.com/community/forums/winforms/multicolumncombo/multi-column-multi-select-using-checkboxes.aspx   
                  I found that multi select option(checkbox)  is not possible in multicolumncombo ,but we can still do workaround by using RadDropDownButton  . 
        my requirements is  i need a dropdown with multi columns and it should allow the user to select multiple rows at the end i have to get the selected rows value....


Thanks,
Dev

Tags
DropDownList
Asked by
dev
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
dev
Top achievements
Rank 1
Share this question
or