Sep 16, 2010, 9:07 AM
[CLOSED] Checkboxgroup not retaining checkbox items
Hi
I think the checkboxes are not retained in the checkboxgroup. Also it looks like there is another (or related) problem with this control.
I'm using the build (downloaded yesterday):
On the onload I add a few checkbox items, those are visible. No problem. If I do an 'Addbuttons click' the added buttons from the onload are gone (count items == 0) ! Only the added buttons are there. This is not expected behaviour because I cannot see which one are checked !
uncommenting //CheckboxGroup1.Render(); does not make any difference.
Another issue I discovered is if you uncomment the value setting lines (like: //c1.Value = "onload 1"; ) you get exceptions.
I hope you can help with a solution or a work around.
I think the checkboxes are not retained in the checkboxgroup. Also it looks like there is another (or related) problem with this control.
I'm using the build (downloaded yesterday):
ex.net: 1, 0, 3910, 17017
ext.utilities: 1, 0, 0, 17014
Let me explain:On the onload I add a few checkbox items, those are visible. No problem. If I do an 'Addbuttons click' the added buttons from the onload are gone (count items == 0) ! Only the added buttons are there. This is not expected behaviour because I cannot see which one are checked !
uncommenting //CheckboxGroup1.Render(); does not make any difference.
Another issue I discovered is if you uncomment the value setting lines (like: //c1.Value = "onload 1"; ) you get exceptions.
I hope you can help with a solution or a work around.
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
var c1 = new Checkbox();
//c1.Value = "onload 1";
c1.BoxLabel = "onload 1";
CheckboxGroup1.Items.Add(c1);
var c2 = new Checkbox();
//c1.Value = "onload 2";
c2.BoxLabel = "onload 2";
CheckboxGroup1.Items.Add(c2);
X.Msg.Notify("added onload:", "total count:" + CheckboxGroup1.Items.Count).Show();
}
protected void BtnAddComboItems_Click(object sender, DirectEventArgs e)
{
X.Msg.Notify("before adding:", "total count:" + CheckboxGroup1.Items.Count).Show();
var c1 = new Checkbox();
//c1.Value = "added 1";
c1.BoxLabel = "added 1";
CheckboxGroup1.Items.Add(c1);
var c2 = new Checkbox();
//c1.Value = "added 2";
c2.BoxLabel = "added 2";
CheckboxGroup1.Items.Add(c2);
//CheckboxGroup1.Render();
X.Msg.Notify("added checkboxes", "total count:" + CheckboxGroup1.Items.Count).Show();
}
protected void BtnShowCheckedComboItems_Click(object sender, DirectEventArgs e)
{
string s = string.Empty;
foreach (Checkbox li in CheckboxGroup1.Items)
{
if (li.Checked)
s += li.BoxLabel + " ";
}
X.Msg.Notify("Test checkboxes", s).Show();
}
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Button ID="btAdd" runat="server" Text="Add some checkboxes">
<DirectEvents>
<Click OnEvent="BtnAddComboItems_Click" />
</DirectEvents>
</ext:Button>
<ext:Button ID="btnShow" runat="server" Text="Show checked items">
<DirectEvents>
<Click OnEvent="BtnShowCheckedComboItems_Click" />
</DirectEvents>
</ext:Button>
<ext:CheckboxGroup ID="CheckboxGroup1" runat="server" >
</ext:CheckboxGroup>
Last edited by geoffrey.mcgill; Sep 21, 2010 at 3:48 PM.
Reason: please use [CODE] tags, [CLOSED]