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

Combobox in AutoGeneratedColumn

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 17 Oct 2011, 03:08 PM
Hello,

In the datasouce I'm using, there is a boolean field I'm showing in an autogenerated column. The problem is, though, that in the database this is a nullable field, so the CheckboxColumn the Grid automatically generates isn't really useful. Is there anyway to have the boolean show in a combobox (which becomes interactive when activating in-line editing), rather than a checkbox, with values for null, true and false?

Any help or directions would be appreciated.

Sincerely,
Glenn

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Oct 2011, 04:09 PM
Hello Glenn,

You can try the following code snippet to add new control instead of CheckBox.
C#:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
   {
       if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
       {
           GridEditFormItem item = (GridEditFormItem)e.Item;
           TableCell cell = item["BoolVal"] ;
           cell.Controls[0].Visible = false;
           RadComboBox cb1 = new RadComboBox();
           cb1.ID = "Radcombo1";
          //Bind the combo
           cell.Controls.Add(cb1);
       }
   }

Thanks,
Princy.
Tags
Grid
Asked by
Glenn
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or