I Have Implemented WebHirachicalDataGrid and i need to get the all the Checked checkBox on Server side. Currently when i am Clicking on checkbox and then Press the Save Button , Form Post Back but Respective Function doesn't Trigger. and Getting Error . My Code is Below
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="id" DataMember="Module" EnableViewState="true" ViewStateMode="Enabled" StyleSetName="Office2007Blue" InitialExpandDepth="3" InitialDataBindDepth="3" Height="350px" Width="900px" > <%--<ClientEvents Initialize="InitializHandler" Click="ClickHandler"/>--%> <%-- <AutoPostBackFlags RowSelectionChanged="false" />--%> <%--<AutoPostBackFlags CellSelectionChanged="Of" />--%> <Columns> <ig:BoundDataField DataFieldName="id" Hidden="true" DataType="System.Int32" Key="id" Width="100px"> <Header Text="Module ID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Item" DataType="System.String" Key="Item"> <Header Text="Module Description" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Data" Hidden="true" DataType="System.String" Key="Data"> <Header Text="Operations" /> </ig:BoundDataField> <%--<ig:BoundCheckBoxField DataFieldName="View" DataType="System.Boolean" Key="View"> <Header Text="View" /> </ig:BoundCheckBoxField> <ig:BoundCheckBoxField DataFieldName="Update" DataType="System.Boolean" Key="Update"> <Header Text="Update" /> </ig:BoundCheckBoxField> <ig:BoundCheckBoxField DataFieldName="Delete" DataType="System.Boolean" Key="Delete"> <Header Text="Delete" /> </ig:BoundCheckBoxField> <ig:BoundCheckBoxField DataFieldName="Save" DataType="System.Boolean" Key="Save"> <Header Text="Save" /> </ig:BoundCheckBoxField>--%> </Columns> <Bands> <%--<ig:Band AutoGenerateColumns="False" DataKeyFields="Item" DataMember="TRN_CODE" Key="ChildBand_0">--%> <ig:Band AutoGenerateColumns="False" DataKeyFields="ChildId" DataMember="TRN_CODE" Key="ChildBand_0"> <Columns> <%-- <ig:BoundDataField DataFieldName="ChildTableId" Hidden="false" DataType="System.Int32" Key="ChildTableId"> <Header Text="ChildTableId" /> </ig:BoundDataField>--%> <ig:BoundDataField DataFieldName="ChildId" Hidden="false" DataType="System.Int32" Key="DataCh"> <Header Text="Child Id" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Item" DataType="System.String" Key="ItemCh"> <Header Text="Menu Name" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ParentId" Hidden="true" DataType="System.Int32" Key="idCh"> <Header Text="Parent ID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Operations" Hidden="false" DataType="System.String" Key="Operations"> <Header Text="Operations" /> </ig:BoundDataField> <ig:BoundCheckBoxField DataFieldName="Trn_Operations" DataType="System.Boolean" Key="Trn_Operations" > <%--<Header Text="Operations" />--%> </ig:BoundCheckBoxField> <%--<ig:BoundCheckBoxField DataFieldName="ChView" DataType="System.Boolean" Key="ChView"> <Header Text="View" /> </ig:BoundCheckBoxField> <ig:BoundCheckBoxField DataFieldName="ChUpdate" DataType="System.Boolean" Key="ChUpdate"> <Header Text="Update" /> </ig:BoundCheckBoxField> <ig:BoundCheckBoxField DataFieldName="ChDelete" DataType="System.Boolean" Key="ChDelete"> <Header Text="Delete" /> </ig:BoundCheckBoxField> <ig:BoundCheckBoxField DataFieldName="ChSave" DataType="System.Boolean" Key="ChSave"> <Header Text="Save" /> </ig:BoundCheckBoxField>--%>
</Columns> <Behaviors> <ig:EditingCore BatchUpdating="True"> <Behaviors> <ig:RowAdding/> <ig:RowDeleting/> <ig:CellEditing/> </Behaviors> </ig:EditingCore> <%--<ig:EditingCore AutoCRUD="false"> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="ItemCh" ReadOnly="true" /> </ColumnSettings> </ig:CellEditing> </Behaviors> </ig:EditingCore>--%> </Behaviors> </ig:Band> </Bands>
<Behaviors>
<ig:Selection CellClickAction="Row" CellSelectType="None" RowSelectType="Single"> <AutoPostBackFlags CellSelectionChanged="false" RowSelectionChanged="false" ColumnSelectionChanged="false" /> <%--<AutoPostBackFlags RowSelectionChanged="false" />--%>
</ig:Selection> <ig:Activation> </ig:Activation> <ig:EditingCore BatchUpdating="True"> </ig:EditingCore> <%--<ig:EditingCore> <Behaviors>
<ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="Item" ReadOnly="true" /> </ColumnSettings> </ig:CellEditing> </Behaviors> </ig:EditingCore>--%> </Behaviors> </ig:WebHierarchicalDataGrid>
private DataTable CreateGridDataSourceForSubModules(string tableName, bool duplicate) {
DataTable SubModules = Trn_Oprations.GetAllTrnsList(); // Create a new DataTable. System.Data.DataTable table = new DataTable(tableName); // Declare variables for DataColumn and DataRow objects. DataColumn column; DataRow row;
// Create new DataColumn, set DataType, // Create First column. //column = new DataColumn(); //column.DataType = System.Type.GetType("System.Int32"); ////column.ColumnName = "Data"; //column.ColumnName = "ChildTableId"; //column.AutoIncrement = false; //column.Caption = "ChildTableId"; //column.ReadOnly = false; //column.Unique = false; //// Add the column to the table. //table.Columns.Add(column);
column = new DataColumn(); column.DataType = System.Type.GetType("System.Int32"); //column.ColumnName = "Data"; column.ColumnName = "ChildId"; column.AutoIncrement = false; column.Caption = "ChildId"; column.ReadOnly = false; column.Unique = false; // Add the column to the table. table.Columns.Add(column);
// Create second column. column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "Item"; column.AutoIncrement = false; column.Caption = "Item"; column.ReadOnly = false; column.Unique = false; // Add the column to the table. table.Columns.Add(column); // ColumnName and add to DataTable. column = new DataColumn(); column.DataType = System.Type.GetType("System.Int32"); column.ColumnName = "ParentId"; column.ReadOnly = true; // Add the Column to the DataColumnCollection. table.Columns.Add(column);
column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "Operations"; //column.DefaultValue = false; table.Columns.Add(column);
column = new DataColumn(); column.DataType = System.Type.GetType("System.Boolean"); column.ColumnName = "Trn_Operations"; column.DefaultValue = false; table.Columns.Add(column);
//TemplateDataField templateCol = new TemplateDataField(); //templateCol.ItemTemplate = new CustomItemTemplate(); //WebHierarchicalDataGrid1.Columns.Add(templateCol); //column = new DataColumn(); //column.DataType = System.Type.GetType("System.Boolean"); //column.ColumnName = "ChView"; //column.AutoIncrement = false; //column.Caption = "View"; ////column.ReadOnly = false; //column.Unique = false; //column.DefaultValue = false; //// Add the column to the table. //table.Columns.Add(column);
//column = new DataColumn(); //column.DataType = System.Type.GetType("System.Boolean"); //column.ColumnName = "ChUpdate"; //column.AutoIncrement = false; ////column.Caption = "Update"; //column.ReadOnly = false; //column.Unique = false; //column.DefaultValue = false; //// Add the column to the table. //table.Columns.Add(column);
//column = new DataColumn(); //column.DataType = System.Type.GetType("System.Boolean"); //column.ColumnName = "ChDelete"; //column.AutoIncrement = false; //column.Caption = "Delete"; //// column.ReadOnly = false; //column.Unique = false; //column.DefaultValue = false; //// Add the column to the table. //table.Columns.Add(column);
//column = new DataColumn(); //column.DataType = System.Type.GetType("System.Boolean"); //column.ColumnName = "ChSave"; //column.AutoIncrement = false; //column.Caption = "Save"; //column.ReadOnly = false; //column.Unique = false; //column.DefaultValue = false; //// Add the column to the table. //table.Columns.Add(column);
//for (int j = 0; j < SubModules.Rows.Count; j++) //{ // string Trn_id = SubModules.Rows[j]["Trn_Id"].ToString(); // DataTable GetTrnOperationsByTrnId = Trn_Oprations.GetOperationsByTrn(Trn_id);
//for (int u = 0; u < GetTrnOperationsByTrnId.Rows.Count; u++) //{ // BoundCheckBoxField field = new BoundCheckBoxField(true); // column = new DataColumn(); // field.Key = "Discontinued" + u + 1; // field.Header.Text = "Discontinued" + u; // field.DataFieldName = "Discontinued" + u; // this.WebHierarchicalDataGrid1. // this.WebHierarchicalDataGrid1.Columns.Add(field); // // column.Columns.Add(field); //} // }
// Make the ID column the primary key column. if (!duplicate) { DataColumn[] PrimaryKeyColumns = new DataColumn[1]; PrimaryKeyColumns[0] = table.Columns["id"]; table.PrimaryKey = PrimaryKeyColumns; } else {
//DataColumn[] PrimaryKeyColumns = new DataColumn[1]; //PrimaryKeyColumns[0] = table.Columns["ChildTableId"]; //table.PrimaryKey = PrimaryKeyColumns; }
for (int k = 0; k < SubModules.Rows.Count; k++) { string TrnId = SubModules.Rows[k]["Trn_Id"].ToString(); DataTable TrnOperations=Trn_Oprations.GetOperationsByTrn(TrnId);
for (int j = 0; j < TrnOperations.Rows.Count; j++) // it Should Create Each by the count of Trn Operations { row = table.NewRow(); // CheckBox cb = new CheckBox(); string a = SubModules.Rows[k]["MODULE_CODE"].ToString(); // row["ChildTableId"] = k; row["ParentId"] = Convert.ToInt32(a); row["Item"] = SubModules.Rows[k]["Menu_Label"].ToString(); row["ChildId"] = Convert.ToInt32(SubModules.Rows[k]["Trn_Id"].ToString()); // BoundCheckBoxField ckField = new BoundCheckBoxField(); // ckField.Key = TrnOperations.Rows[j]["Opr_Description"].ToString(); row["Operations"] = TrnOperations.Rows[j]["Opr_Description"].ToString(); //((BoundCheckBoxField)this.WebHierarchicalDataGrid1.Columns["Operations"]).ValueConverter = ; string OperationName= TrnOperations.Rows[j]["Opr_Description"].ToString(); table.Rows.Add(row);
} }
return table;
}
Hello Muhammad,
I noticed that in the following forum thread the same behavior is discussed. Please, keep in mind that according to our support policy we handle singe thread per issues. This helps us ensure that all issues are addressed and handled correctly.
Please have a look at this forum thread where I have already provided an answer and let me know if you have any additional questions.
Thank you for using Infragistics components.
Regards,
Monika Kirkova,
Infragistics