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

Databinding of properties of Dropdown items.

2 Answers 61 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
JD.
Top achievements
Rank 1
JD. asked on 16 Aug 2012, 11:05 AM
Hi,

We have a radcombobox with list of Regions that gets populated with EntityDataSource, now we added a new column in table named as "MarkAsDeleted" We want to disable Regions in radcombobox where region is "MarkAsDeleted" = true.

I found that   it has property as below,  just don;t know how to automatically allow databinding to this property.

  <telerik:RadComboBoxItem runat="server" Enabled="False" Text="RadComboBoxItem3"
                            Value="RadComboBoxItem3" />

Any idea ?

Regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 16 Aug 2012, 01:00 PM
Hi JD.,

You could try to use the following implementation at the ItemDataBound event handler :

protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
    {
      var MarkAsDeleted = Convert.ToBoolean(((DataRowView)e.Item.DataItem)["MarkAsDeleted"]);
 
       e.Item.Enabled = !MarkAsDeleted;
    }


Kind regards,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
JD.
Top achievements
Rank 1
answered on 17 Aug 2012, 05:16 AM

I was hoping if there was any declarative way of doing the same to avoid recompilation.

But this works for now.  Thanks.

Regards


Tags
ComboBox
Asked by
JD.
Top achievements
Rank 1
Answers by
Nencho
Telerik team
JD.
Top achievements
Rank 1
Share this question
or