Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
WHDG Child Bands Give no Data in code behind c#
posted

i have implemented Web Hirachical Data Grid with N Level of childs . on Save Button i need to get the Checked and unchecked Child bands in code Behind but i am getting 0 count on  WebHierarchicalDataGrid1.GridView.Rows[row.Index].RowIslands. 

My Code Behind code is :

protected void WebHierarchicalDataGrid1_RowIslandDataBound(object sender, RowIslandEventArgs e)
{
if (hdgEnterExit.GridView.Rows[0].RowIslands.Count > 0)
{
var childGrid2 = hdgEnterExit.GridView.Rows[0].RowIslands[0];

foreach (GridRecord record in childGrid2.Rows)
{
var c = record.Items[0].FindControl("chkChon") as CheckBox;

if (c != null && c.Checked)
{

}
// userListId += record.Items[1].Value + ";";
}
}

}


protected void btnSaveAccessGrid_Click(object sender, EventArgs e)
{

foreach (GridRecord row in hdgEnterExit.Rows)
{
// var b = row.Items[0].FindControl("chkChon") as CheckBox;

// Get row island using data member
if (hdgEnterExit.GridView.Rows[row.Index].RowIslands != null &&
hdgEnterExit.GridView.Rows[row.Index].RowIslands.Count > 0)
{
var childGrid2 = hdgEnterExit.GridView.Rows[row.Index].RowIslands[0];

foreach (GridRecord record in childGrid2.Rows)
{
var c = record.Items[0].FindControl("Operation") as CheckBox;

if (record.Items[2].Value.Equals("thuynt.bic"))
{
string x = "1";
}
if (c != null && c.Checked)
{

}
//userListId += record.Items[1].Value + ";";
}
}


}


int count = hdgEnterExit.Rows.Count;


for (int i = 0; i < count; i++)
{
var a = hdgEnterExit.Bands.FindByDataMember("TRN_CODE").Columns.FromKey("Menu_Label");
//var Bands = hdgEnterExit.Rows[i].Items.Grid.DataKeyFields().;
// var row = hdgEnterExit.getChildRow

// if (Convert.ToBoolean(hdgEnterExit.Rows[i].Items.FindItemByKey("Menu_Label").Value) == true)
//{

//POST[j] = Convert.ToBoolean(grdPay.Rows[i].Items.FindItemByKey("All_Post_Checkbox").Value) == true ? 1 : 0;
//Status[j] = 1; // processed
//ParticipantCode[j] = Convert.ToString(grdPay.Rows[i].Items.FindItemByKey("PARTICIPANT_CODE").Value);

//System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-GB");
////SettlementDate[j] = DateTime.Parse( grdPay.Rows[i].Items.FindItemByKey("SETTLEMENT_DATE").Value.ToString());
////SettlementDate[j] = Convert.ToDateTime()
//SettlementDate[j] = Convert.ToDateTime(grdPay.Rows[i].Items.FindItemByKey("SETTLEMENT_DATE").Value.ToString(), culture);
//ProcessedDate[j] = GetSystemDate();
//IsMannual[j] = 1;
//LogID[j] = Log_ID;
//RefNumber[j] = SystemUtil.GetNextRefNo(CurrentRefernceNumber);
//CurrentRefernceNumber = RefNumber[j];
//j = j + 1;

// }


}


}

 and on Front Side :

<ig:WebHierarchicalDataGrid ID="hdgEnterExit" runat="server" EnableRelativeLayout="True" ShowFooter="False" HeaderCaptionCssClass="HeaderCaptionClass" ItemCssClass="ItemCssClass"
AltItemCssClass="AltItemCssClass" FooterCaptionCssClass="HeaderCaptionClass" AutoGenerateColumns="False" AutoGenerateBands="True"
DataMember="Module"
DataKeyFields="Module_Id"
InitialDataBindDepth="-1"
Width="860px"
EnableDataViewState="true" EnableViewState="true" OnRowIslandDataBound="WebHierarchicalDataGrid1_RowIslandDataBound">

<Columns>
<ig:BoundDataField DataFieldName="Module_Id" Key="Module_Id" Footer-Text="Module_Id" Header-Text="Module_Id" CssClass="CenterAlign" Width="70">
</ig:BoundDataField>
</Columns>
<Columns>
<ig:BoundDataField DataFieldName="Module_Label" Key="Module_Label" Footer-Text="Module_Label" Header-Text="Module_Label" CssClass="CenterAlign" Width="120">
</ig:BoundDataField>
</Columns>


<Bands>
<ig:Band Key="Trn_Id" AutoGenerateColumns="false" DataMember="TRN_CODE" DataKeyFields="Trn_Id">
<Columns>
<ig:BoundDataField DataFieldName="Menu_Label" Key="Menu_Label" Header-Text="Menu_Label" CssClass="CenterAlign" Width="520">
</ig:BoundDataField>
</Columns>

<Bands>
<ig:Band Key="Trn_Id" AutoGenerateColumns="false" DataMember="TRN_Operations" DataKeyFields="Trn_Id,Operation_Id">
<Columns>
<ig:BoundDataField DataFieldName="Operation_Id" Key="Operation_Id" Header-Text="Operation_Id" CssClass="CenterAlign" Width="420">
</ig:BoundDataField>
<ig:BoundCheckBoxField DataFieldName="Operation" DataType="System.Boolean"
VisibleIndex="1" Key="Operation" Width="180px">
<Header Text="Operation" >

</Header>
</ig:BoundCheckBoxField>
</Columns>
<Bands>
</Bands>
</ig:Band>
</Bands>
</ig:Band>
</Bands>
<Behaviors>
<ig:EditingCore EnableInheritance="True" Enabled="true">
<EditingClientEvents CellValueChanging="WebHierarchicalDataGrid1_Editing_CellValueChanging"/>
<Behaviors>
<ig:CellEditing EnableInheritance="true">
<EditModeActions EnableOnActive="True" MouseClick="Single" />
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
</Behaviors>
</ig:WebHierarchicalDataGrid>

Parents
No Data
Reply
  • 1560
    Offline posted
    Hello,
    I noticed that there is an additional forum thread regarding the same query. 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 take 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.

    Sincerely,
    Teodosia Hristodorova
    Associate Software Developer
Children
No Data