Populating checkboxlist in UserControl took ages

25 views Asked by At

I created UserControl with asp.net that contains asp TextBox and asp Checkboxlist. For my control, I created the property that gets values as DataTable and then populates CheckboxList with values.

 Public Property DataSourceItem as DataTable
  Get
     Return CheckBoxList.DataSource
  End Get
  Set(ByVal value as DataTable)
     CheckBoxList.DataSource = value
     CheckboxList.DataTextField = value.Columns(0).ToString
     CheckboxList.DataValueField = value.Columns(0).ToString
     CheckboxList.DataBind()
  End Set
 End Property

And now I have a problem because if I paste eg 40 UserControls on Page it took ages to populate them with data. It works fine when I change control type from my UserControl to eg regular asp DropdownList.

Could someone help me to investigate this?

0

There are 0 answers