Buddy, As you can see from this code I have Accordion panel and inside it check box group I try to generate the check boxes for this check box group in code behind in C#, I can do and every thing is OK , in the first time the page open for me and i checked the check boxes and send the value to database, when I want to retrieve the check boxes to see which check boxs was checked in the first time i should click the edit button that place inside the grid panel 2 time in the first time it brings for me the check boxes only without show me the boxes was checked when I click the second time it shows me the boxes was checked this is my problem
----for me I want from you if you cold please, only to check the code inside load grid function and see for me is this code OK or no, think only some thing small lost and every thing will be ok
<ext:FormPanel ID="fEmployees" runat="server" Title="موظف جديد" PaddingSummary="5px 5px 0"
Width="400" Frame="true" ButtonAlign="Left" AutoHeight="true"
AutoRender="true" IDMode="Static">
<Items>
<ext:Toolbar ID="tbEmployee" runat="server" >
<Items>
<ext:Button ID="btnSave" runat="server" Icon="Disk" ToolTip="حفظ">
<Listeners>
<Click Handler="SaveEmployee(#{fEmployees});" />
</Listeners>
</ext:Button>
<ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server"></ext:ToolbarSeparator>
<ext:Button ID="btnReset" runat="server" Icon="Script" ToolTip="افراغ الحقول">
<Listeners>
<Click Handler="#{fEmployees}.getForm().reset(); " />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
<ext:Checkbox IDMode="Static" ID="cbMainEmp" runat="server" FieldLabel="هل هو مستقبل رئيسي"
ColumnWidth="1" LabelWidth="100" BlankText="" />
<ext:Checkbox IDMode="Static" ID="cbCtsEmp" runat="server" FieldLabel="هل هو موظف مراسلات"
ColumnWidth="1" LabelWidth="100">
<Listeners>
<Check Fn="CheckCtatse" />
</Listeners>
</ext:Checkbox>
<ext:Checkbox IDMode="Static" ID="cbRespOut" Hidden="true" runat="server" FieldLabel="مسؤل صادر"
ColumnWidth="1" LabelWidth="100">
<Listeners>
<Check Fn="GetByCatigory" />
</Listeners>
</ext:Checkbox>
<ext:Checkbox IDMode="Static" ID="cbResIn" Hidden="true" runat="server" FieldLabel="مسؤل وارد"
ColumnWidth="1" LabelWidth="100">
<Listeners>
<Check Fn="GetByCatigory" />
</Listeners>
</ext:Checkbox>
<%-- --%>
<ext:Panel IDMode="Static" ID="panAccordion" runat="server" Title="مراسل صادر وارد"
AutoHeight="true" Height="400" BodyBorder="false" Icon="ApplicationTileVertical"
Layout="Accordion" Hidden="true" AutoShow="True" AutoWidth="True">
<LayoutConfig>
<ext:AccordionLayoutConfig Animate="true" />
</LayoutConfig>
<Items>
<ext:Panel IDMode="Static" ID="Paout" runat="server" Title="مراسل صادر" Collapsed="true"
AutoHeight="true">
<Items>
<ext:CheckboxGroup IDMode="Static" ID="cbgout" runat="server" ColumnsNumber="1" Hidden="true">
<Items>
<ext:Checkbox ID="cboutdef" runat="server" BoxLabel="lbcbout" Checked="true" />
</Items>
</ext:CheckboxGroup>
</Items>
</ext:Panel>
<ext:Panel ID="pain" runat="server" Title="مراسل وارد" Collapsed="true" AutoHeight="true">
<Items>
<ext:CheckboxGroup IDMode="Static" ID="cbgin" runat="server" ColumnsNumber="1" Hidden="true">
<Items>
<ext:Checkbox ID="cbindef" runat="server" BoxLabel="lbcbin" Checked="true" />
</Items>
</ext:CheckboxGroup>
</Items>
</ext:Panel>
</Items>
</ext:Panel>
<%-- --%>
<%-- ///////////////////////////////////////////--%>
</Items>
<Items>
<ext:GridPanel IDMode="Static" ID="gpEmp" StoreID="stEmp" Collapsible="true" Collapsed="true"
runat="server" AutoHeight="true" Title="الموظفين" StripeRows="true" TrackMouseOver="true"
AutoWidth="true" AutoExpandColumn="Employee_Name" AutoScroll="true">
<ColumnModel ID="ColumnModel1" runat="server" >
<Columns>
<ext:RowNumbererColumn ColumnID="rowIndex" />
<ext:Column ColumnID="EmpName" DataIndex="Employee_Name" Header="اسم الموظف">
</ext:Column>
<ext:Column ColumnID="Empemil" DataIndex="Employee_EmailAdress" Header="البريد الألكتروني" Width="150px">
</ext:Column>
<ext:Column ColumnID="Reg_date" DataIndex="Employee_RegisteredDate" Header="تاريخ الأنشاء">
</ext:Column>
<ext:Column ColumnID="Position" DataIndex="Employee_Position" Header="المسمى الوظيفي">
</ext:Column>
<ext:Column ColumnID="Statuse" DataIndex="Employee_Status" Header="حالة الموظف" >
<Renderer Fn="rendericone" />
</ext:Column>
<ext:CommandColumn Header="العمليات">
<Commands>
<ext:GridCommand CommandName="Edit" Icon="NoteEdit" Text="تعديل">
<ToolTip Text="تعديل" />
</ext:GridCommand>
<ext:CommandSeparator />
<ext:GridCommand CommandName="Delete" Icon="Delete" Text="حذف">
<ToolTip Text="حذف" />
</ext:GridCommand>
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<LoadMask ShowMask="true" Msg="جاري التحميل" />
<Plugins>
<ext:GridFilters runat="server" ID="GridFilters1" Local="true" Enabled="true" ShowMenu="true">
<Filters>
<ext:StringFilter DataIndex="Group_Name">
</ext:StringFilter>
</Filters>
</ext:GridFilters>
</Plugins>
<BottomBar>
<ext:PagingToolbar Cls="Pager" PageSize="10" StoreID="stEmp" NextText="التالي" PrevText="السابق"
FirstText="الصفحة الاولى" LastText="الصفحة الاخيرة" runat="server" ID="ptpMain">
</ext:PagingToolbar>
</BottomBar>
<Listeners>
<Command Handler="CommandHandler(#{fEmployees},command,record);" />
</Listeners>
</ext:GridPanel>
</ext:FormPanel>
C# code
this code receive Edit action from grid panel:
[DirectMethod]
public string CommandHandler(string command, int EmpID)
{
try
{
if (command == "Edit")
{
string ID = (string)hidevalu.Value;
int tempx = Convert.ToInt32(ID);
Employees emp = new Employees();
emp = EmployeesDB.GetItem(tempx);
Hierarchy hier = new Hierarchy();
//////////////////
//////////empCatalogprevaleg/////////
if (cbCtsEmp.Checked)
{
List<EmployeesCatigoriesPreveleges> empcp = EmployeesCatigoriesPrevelegesDB.GetList();
var empcplist = from empcatalogP in empcp
where empcatalogP.Employee_ID == tempx //&& o.Hierarchy_IsDeleted == false
select empcatalogP;
EmployeesCatigoriesPreveleges emcatprev = empcplist.ElementAt(0);
cbResIn.Checked = emcatprev.EmployeeCatigoriesPrevelege_HaveImportPrevelege.Value;
cbRespOut.Checked = emcatprev.EmployeeCatigoriesPrevelege_HaveExportPrevelege.Value;
cbResIn.RemoveListener("Check", "GetByCatigory");
cbRespOut.RemoveListener("Check", "GetByCatigory");
if (cbRespOut.Checked)
{
Paout.Enabled = true;
string ExpPriv = emcatprev.EmployeeCatigoriesPrevelege_ExportCatigoriesPrevelegs;
string[] elem = ExpPriv.Split(',');
Paout.ClearContent();
cbgout.Hidden = false;
panAccordion.Hidden = false;
Paout.Hidden = false;
panAccordion.Show();
//Paout.Expand();
cbgout.Items.RemoveAt(0);
LoadGrid(0, elem);
cbRespOut.AddListener("Check", "GetByCatigory");
}
if (cbResIn.Checked)
{
pain.Enabled = true;
string ExpPriv = emcatprev.EmployeeCatigoriesPrevelege_ImportCatigoriesPrevelegs;
string[] elem1 = ExpPriv.Split(',');
cbgin.Hidden = false;
panAccordion.Hidden = false;
pain.Hidden = false;
// pain.Expand();
pain.ClearContent();
cbgin.Items.RemoveAt(0);
LoadGrid(1, elem1);
cbResIn.AddListener("Check", "GetByCatigory");
}
//if (cbRespOut.Checked)
//{
// loadgrid(0, elem);
//}
//if (cbResIn.Checked)
//{
// loadgrid(1, elem);
//}
return "ok";
}
}
}
catch (Exception ex)
{
return ex.Message;
}
return "Unknown";
}
}
this code using to create the check boxes inside the check box group:
private void LoadGrid(int value, string[] arr)
{
MailsCategories mailCat = new MailsCategories();
mailCat.Hierarchy_CategoryType = value;
List<MailsCategories> ms = MailsCategoriesDB.GetList(mailCat);
////////////////////////// ////////////////////////////////
int i = 0;
if (ms.Count() > 0)
{
//cbgout.Items.RemoveAt(0);
//cbgin.Items.RemoveAt(0);
foreach (MailsCategories mC in ms)
{
Ext.Net.Checkbox ck = new Ext.Net.Checkbox();
ck.AutoWidth = true;
ck.ID = "cbResout" + i;
ck.FieldLabel = mC.MailCategory_Name;
ck.Tag = mC.MailCategory_ID.ToString();
for (int tempcatval = 0; tempcatval < arr.Length; tempcatval++)
{
if (arr[tempcatval] == mC.MailCategory_ID.ToString())
{
ck.Checked = true;
ck.Value = true;
break;
}
}
//ck.Checked = Convert.ToBoolean(false);
ck.InputValue = "cbResout" + i;
ck.LabelAlign = Ext.Net.LabelAlign.Left;
if (value == 0)
{
cbgout.Items.Add(ck);
}
else
{
cbgin.Items.Add(ck);
}
i++;
}
if (value == 0)
{
cbgout.AddTo(this.Paout);
//cbgout.Render();
}
else
{
cbgin.AddTo(this.pain);
}
//stCategorymails.RefreshAfterSaving = Ext.Net.RefreshAfterSavingMode.Auto;
//stCategorymails.DataSource = li;
//stCategorymails.DataBind();
cbgout.Visible = true;
cbgin.Visible = true;
}
}