0

I've been struggling all day trying to figure out the following problem.

I am creating a custom web control in ASP .NET so that I can render my CheckBoxList different than Microsoft.

public class DefaultCheckBoxList : ListControl, IRepeatInfoUser,INamingContainer, IPostBackDataHandler

I am rendering multiple checkboxes (which are also custom controls)

protected override void Render(HtmlTextWriter writer)
        {

            int i = 0;
            foreach (ListItem listItem in Items)
            {
                SetControlToRepeatID(this, _controlToRepeat, i);
                _controlToRepeat.Text = listItem.Text;
                _controlToRepeat.Checked = listItem.Selected;
                _controlToRepeat.Enabled = Enabled ? listItem.Enabled : Enabled;
                _controlToRepeat.AccessKey = _oldAccessKey;
                _controlToRepeat.RenderControl(writer);
                i++;
            }
        }

The problem is that even though the Items are selected in .aspx

                    <Items>  
                        <asp:ListItem Selected="true" Value="Mon" Text="Mon" ></asp:ListItem>
                        <asp:ListItem Enabled="false" Value="Tue" Text="Tue" ></asp:ListItem>
                        <asp:ListItem Selected="true" Value="Wed" Text="Wed"></asp:ListItem>
                        <asp:ListItem Selected="true" Value="Thu" Text="Thu" ></asp:ListItem>
                        <asp:ListItem Selected="true" Value="Fri" Text="Fri"></asp:ListItem>
                        <asp:ListItem Selected="true" Value="Sat" Text="Sat"></asp:ListItem>
                        <asp:ListItem Selected="true" Value="Sun" Text="Sun"></asp:ListItem>
                    </Items>
                </cc1:DefaultCheckBoxList>

the enumeration has the first selected only. I have checked .NET reference code and they seem to override

 internal virtual bool IsMultiSelectInternal;

Therefore I am trying to do the same in my code. The problem is that I cannot find the specific property to override from my Web control.

internal override bool IsMultiSelectInternal  {
            get  {                `
                return true;
           }
        }

returns: Error

51  'IsMultiSelectInternal': no suitable method found to override   

Any help would be appreciated.

Thanks.

0 Answers0