Databinding of properties of Dropdown items.

3 posts, 1 answers
  1. JD.
    JD. avatar
    37 posts
    Member since:
    Aug 2012

    Posted 16 Aug 2012 Link to this post

    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. Answer
    Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 16 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. JD.
    JD. avatar
    37 posts
    Member since:
    Aug 2012

    Posted 17 Aug 2012 Link to this post


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

    But this works for now.  Thanks.

    Regards


Back to Top