Maximum checked allow in CheckBoxList
<p>I have generated a CheckBoxList which has more than one item using C#. Now I want to set a maximum number of checked item allowed in CheckBoxList. If user check more than maximum allowed item, there will be an alert or the other item will automatic uncheck to prevent user check over maximum number of item allowed.</p>

<p>The maximum number of checked item will be set up to ChecokBoxList in code-behind (C#) or using javascript do this, but the javascript is also should be generated in C# too.</p>

<p>I need some help to solve this issue.</p>

<p>Example Code:</p>

<pre><code>CheckBoxList chkl = new CheckBoxList();
string[] items = {"item1", "item2", "item3", "item4", "item5"};
foreach (string item in items )
            {
                chkl.Items.Add(new ListItem(item));
            }
chkl.MaximumCheck = 3;
</code></pre>

<p>After generated in code-behind, the CheckBoxList will only allow user to check only three items. If user check more than three item, other item will automatic uncheck or at least an alert will show to prevent user check more than three items.</p>
