Apr 08, 2011, 3:11 PM
Runtime Checkbox value update issue.
Following is a sample code, I have been banging my head against. All I want is when I check the Parent Checkbox, Child should be checked as well. Kind of toggel with Parent.
What I am observing is that the Child Checkbox's value is set correctly, but it is not shown on the web page (it should be same as Parent). Now, if were to just Alt+Tab to another window and Alt+Tab back to the web browser, it automatically shows correct value in Child Checkbox (same as Parent). Have anyone faced this? Am I missing something in code to refresh the checkbox status after assigning the value? Help!
What I am observing is that the Child Checkbox's value is set correctly, but it is not shown on the web page (it should be same as Parent). Now, if were to just Alt+Tab to another window and Alt+Tab back to the web browser, it automatically shows correct value in Child Checkbox (same as Parent). Have anyone faced this? Am I missing something in code to refresh the checkbox status after assigning the value? Help!
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ExtTest1._Default" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
var CB1_Changed = function (e) {
if (e.checked) {
Ext.getCmp("Checkbox2").setValue(true);
} else {
Ext.getCmp("Checkbox2").setValue(false);
};
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:FormPanel ID="FormPanel1" runat="server" Title="My Test Form" Padding="5"
Frame="true" LabelWidth="100" Width="300"
Height="200">
<Items>
<ext:Checkbox ID="Checkbox1" BoxLabel="Parent" runat="server">
<Listeners>
<Change Fn="CB1_Changed" />
</Listeners>
</ext:Checkbox>
<ext:CheckboxGroup ID="CheckboxGroup1" runat="server">
<Items>
<ext:Checkbox ID="Checkbox2" BoxLabel="Child" runat="server">
</ext:Checkbox>
</Items>
</ext:CheckboxGroup>
</Items>
</ext:FormPanel>
</form>
</body>
</html>