I'm trying to assign a Datasource to a Checkboxlist inside template for my DetailsView control.
private class membershipChkLst : ITemplate
{
    private CheckBoxList chk_lst_Members;
    public membershipChkLst()
    {
        chk_lst_Members = new CheckBoxList();
    }
    public object AssignDataSource
    {
        get { return this.chk_lst_Members.DataSource; }
        set { this.chk_lst_Members.DataSource = value; }
    }
    public void InstantiateIn(Control container)
    {
        if (container != null)
        {
       开发者_如何学Go     container.Controls.Add(chk_lst_Members);
        }
    }
}
Is the syntax correct or am I doing it wrong?
Something like this
public membershipChkLst(DataTable dt)
{
   chklst  = new CheckBoxList();
   chklst.ID = "chklstid";
   chklst.DataSource = dt;
   chklst.DataBind();
}
Pass in your required datasource (i added DataTable just to show) and this would help achieve what you want.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论