asp.net - Replace CheckBoxList TemplateControl with custom UserControl? -
I'm trying to create more detailed item templates for standard checkbox list controls. It exposes a ITemplate property called TemplateControl, but I did not really find it to use can not find a simple resource here is the code I have so far:
Protected Overrides Sub OnLoad ( ByVal e as System.EventArgs) MyBase.OnLoad (e) dim before new list (ListItem's) items.Add (new ListItem () to {.text = 'a' along, .Value = "1"}) items.Add (new ListItem () {.text = "B", .Value = "2"}) (with items.Add (new ListItem) {.text = 'C', .Value = "3"}) Dim Lst New CheckBoxList () dim TPL as ITemplate = LoadTemplate ("~ /CustomListItem.ascx") Dim G New (with as TemplateControlWrapper) TPL .InstantiateIn (g) lst.TemplateControl = g lst.DataSource = item lst.DataBind () Form.Controls.Add (lst) End Sub class got TemplateControlWrapper inherited UserControl End Class
It seems TemplateControl is completely ignoring the property, any thoughts? TemplateControl property of CheckBoxList is not really allowed to modify the template of CheckBoxList. You do not have permission to modify the template in CheckBoxList.
Checkboxist control does not offer the template modification of the type you want to do.
Comments
Post a Comment