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.

It is found in all sorts of heritage property SystemkWebkUIkControl, and it remains in CheckBoxList that means templated control, or put another way, .aspx pages, .ascx user control, or master The page controls that lives on. (If the control is included as part of the overall control, so I do not know without using sincerely template Kantroliynt estate faucet comes back, or unless a page or can not get over the control range of the Ughrtront Yes.)

Checkboxist control does not offer the template modification of the type you want to do.

In order to obtain the functionality you are looking for, you may need to custom-bind a repeater or datalist (in the check box control in the madamplate).

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -