RadGrid with dynamically created template column containing Multiselect combobox

2 posts, 0 answers
  1. Abhishek
    Abhishek avatar
    21 posts
    Member since:
    Mar 2011

    Posted 21 Jun 2011 Link to this post

    Hi,
    I am using a rad grid. I have added custom template columns dynamically. On template column i am having a custom multiselect combobox (RadComboBox with CheckBox and Label inside ItemTemplate).

    How can i access the combo selected value on post back due to save buton click.
    if possible send me sample solution with dynamically created multiselect ComboBox.

    I am using following code snnipet for custom combobox:

    public class CustomDDLItemTemplate : ITemplate
    {

        ListItemType templateType;
        string ColName = "AppName";

        /// <summary>
        /// Create the template
        /// </summary>
        /// <param name="container"></param>
        public void InstantiateIn(Control container)
        {      
            CheckBox checkBox = new CheckBox();
            Label lblDisplayText = new Label();      

            checkBox.ID = "checkBox";
            checkBox.Attributes.Add("onclick", "onCheckBoxClick(this,'"+ container.ClientID +"');");
            
            lblDisplayText.ID = "label";
            lblDisplayText.DataBinding += new EventHandler(this.Label_DataBind);

            // Create a new HtmlGenericControl.
            HtmlGenericControl NewControl = new HtmlGenericControl("div");

            // Set the properties of the new HtmlGenericControl control.      
            NewControl.Attributes.Add("onclick", "StopPropagation(event);");

            // Add the new HtmlGenericControl to the Controls collection of the PlaceHolder control. 
            container.Controls.Add(NewControl);

            NewControl.Controls.Add(checkBox);
            NewControl.Controls.Add(lblDisplayText);              
            break; 
        }

        public void Label_DataBind(Object sender, EventArgs e)
        {
            Label lbl = (Label)sender;
            RadComboBoxItem radCombo = (RadComboBoxItem)lbl.NamingContainer;     
            lbl.Text = DataBinder.Eval(radCombo.DataItem, ColName).ToString();
        }

      
    }


  2. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 24 Jun 2011 Link to this post

    Hi Abhishek,

    Probably you will find helpful the following forum post:

    http://www.telerik.com/community/forums/aspnet-ajax/combobox/how-get-the-value-selected-from-a-multi-column-radcombobox.aspx

    Regards,
    Helen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top