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();
}
}