RadCombobox Insert and Databind Sample Time

2 posts, 0 answers
  1. mohamed
    mohamed avatar
    311 posts
    Member since:
    Mar 2011

    Posted 16 Jul 2012 Link to this post



    I want insert and databind in radcombobox ,
    How i achieve this
    RadComboBoxItem Item6 = new RadComboBoxItem(Resources.Ticket.Action_Knowledge_Base);
    Item6.Value = "1";
    Item6.ImageUrl = "../Content/images/contextmenu/knowledgebase.png";
    ddl_Actions.Items.Insert(8, Item6);
     
    RadComboBoxItem Item7 = new RadComboBoxItem(Resources.Ticket.Action_CustomAction);
    Item7.Value = "9";
    Item7.ImageUrl = "../Content/images/contextmenu/caction.png";
    ddl_Actions.Items.Insert(9, Item7);
     
    RadComboBoxItem Item8 = new RadComboBoxItem(Resources.Ticket.Ticket_RemoveFromFolder);
    Item8.Value = "12";
    Item8.ImageUrl = "../Content/images/contextmenu/remove-from-folder.png";
    ddl_Actions.Items.Insert(10, Item8);
     
    RadComboBoxItem Item10 = new RadComboBoxItem(Resources.Ticket.Ticket_Create_Change_Request);
    Item10.Value = "10";
    Item10.ImageUrl = "../Content/images/contextmenu/changerequest_conf.png";
    ddl_Actions.Items.Insert(11, Item10);
     
    RadComboBoxItem Item11 = new RadComboBoxItem(Resources.TicketSubscription.Subscribe);
    Item11.Value = "11";
    Item11.ImageUrl = "../Content/images/contextmenu/subscribe.png";
    ddl_Actions.Items.Insert(12, Item11);
     
    using (var db = new TBSHelpDeskDataContext(Globals.strCon))
    {
        var md = (from a in db.CustomActions select new { a.CustomAction_ID, a.Name }).ToList();
        ddl_Actions.DataSource = md;
        ddl_Actions.DataValueField = "CustomAction_ID";
        ddl_Actions.DataTextField = "Name";
        ddl_Actions.DataBind();
    }


    Thanks Advance,
    Mohamed.
  2. Nencho
    Admin
    Nencho avatar
    1795 posts

    Posted 16 Jul 2012 Link to this post

    Hello Mohamed,

    You could set the AppendDataBoundItems property of the RadComboBox to True, in order to achieve the desired functionality. You could find our help article about the desired scenario here.

    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.
Back to Top