Apr 28, 2013, 1:46 PM
[OPEN] [#251] Dynamically created Checkbox not Checked
If a Checkbox is dynamically created and added to a CheckboxGroup, the Checked property does not appear to be rendering correctly.
In the following sample, the second and third Checkbox should be checked after clicking the "Add Checkboxes" Button.
In the following sample, the second and third Checkbox should be checked after clicking the "Add Checkboxes" Button.
<%@ Page Language="C#" %>
<script runat="server">
protected void Button1_Click(object sender, DirectEventArgs e)
{
this.CheckboxGroup1.Items.Add(new Checkbox
{
ID = "Checkbox1",
BoxLabel = "Checkbox 1",
});
this.CheckboxGroup1.Items.Add(new Checkbox
{
ID = "Checkbox2",
BoxLabel = "Checkbox 2",
Checked = true,
});
this.CheckboxGroup1.Items.Add(new Checkbox
{
ID = "Checkbox3",
BoxLabel = "Checkbox 3",
Checked = true,
});
this.CheckboxGroup1.Render();
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Button runat="server" Text="Add Checkboxes" OnDirectClick="Button1_Click" />
<ext:CheckboxGroup
ID="CheckboxGroup1"
runat="server"
FieldLabel="Items"
ColumnsNumber="1"
/>
</form>
</body>
</html>