I have a problem to get a rows of band on WebHierarchicalDataGrid, follow code above:
I can see a rows of a band, a try different ways, but return always only a Father values not a Child.
ASPX.CS:
protected void btnGerarConsulta_Click(object sender, EventArgs e) { foreach (Infragistics.Web.UI.GridControls.GridRecord row in grdTabelaColuna.Rows) { foreach (Infragistics.Web.UI.GridControls.GridRecordItem item in row.Items) { CheckBox chkSelecionado = ((CheckBox)row.FindControl("chkSelecione")); if (chkSelecionado != null) if (chkSelecionado.Checked) { camadaObjeto.consulta.Usuario = 1; camadaObjeto.consulta.Coluna = item.Text; camadaNegocio.generica.InsereGenericaTabelaColuna(); } } } }
ASPX:
<ig:WebHierarchicalDataGrid ID="grdTabelaColuna" runat="server" EnableDataViewState="false" AutoGenerateColumns="False" AutoGenerateBands="False" DataKeyFields="idTabela" DataMember="Tabela" Key="Tabela" Width="600px"><GroupingSettings><RemoveButton AltText="Ungroup Column"></RemoveButton></GroupingSettings>
<Columns> <ig:BoundDataField DataFieldName="idTabela" Hidden="True" Key="bcidTabela"> <Header Text="idTabela" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Tabela" Key="bcTabela"> <Header Text="Tabela" /> </ig:BoundDataField> </Columns>
<CollapseButton AltText="Collapse Row"></CollapseButton>
<ExpandButton AltText="Expand Row"></ExpandButton> <Bands> <ig:Band AutoGenerateColumns="False" DataMember="Coluna" Key="Coluna"> <ExpandButton AltText="Expand Row" /> <CollapseButton AltText="Collapse Row" /> <GroupingSettings> <RemoveButton AltText="Ungroup Column" /> </GroupingSettings> <Columns> <ig:BoundDataField DataFieldName="idColuna" Hidden="True" Key="bcidColuna"> <Header Text="idColuna" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="idTabela" Hidden="True" Key="bcidTabela"> <Header Text="idTabela" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Coluna" Key="bcColuna"> <Header Text="Coluna" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Tipo" Hidden="True" Key="bcTipo"> <Header Text="Tipo" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Tamanho" Hidden="True" Key="bcTamanho"> <Header Text="Tamanho" /> </ig:BoundDataField> <ig:TemplateDataField Key="Selecionado"> <ItemTemplate> <asp:Panel ID="Panel1" runat="server" HorizontalAlign="Center" Width="100%"> <asp:CheckBox ID="chkSelecione" runat="server" /> </asp:Panel> </ItemTemplate> <HeaderTemplate> <asp:Panel ID="Panel2" runat="server" HorizontalAlign="Center"> Selecione </asp:Panel> </HeaderTemplate> </ig:TemplateDataField> </Columns> </ig:Band> </Bands> <Behaviors> <ig:Selection CellSelectType="None"> </ig:Selection> </Behaviors> </ig:WebHierarchicalDataGrid> <asp:Button ID="btnGerarConsulta" runat="server" Text="Gerar Consulta" Width="602px" BackColor="#A2D4F4" BorderColor="#66CCFF" BorderStyle="Outset" BorderWidth="1px" ForeColor="White" style="font-family: Verdana; font-weight: 700; color: #FFFFFF" onclick="btnGerarConsulta_Click" /> <br /> <br /> <table class="style1"> <tr> <td> <hr width="30px" align="left" /> </td> <td> <asp:Label ID="Label1" runat="server" Font-Names="Verdana" Font-Size="Small" Text="Resultado da Pesquisa" Width="150px" /> </td> <td> <hr width="607px" align="left" /> </td> </tr> </table> <ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" Height="350px" Width="800px"><GroupingSettings><RemoveButton AltText="Ungroup Column"></RemoveButton></GroupingSettings>
<ExpandButton AltText="Expand Row"></ExpandButton> </ig:WebHierarchicalDataGrid>
Thanks.
Hi,
If you want to access a templated checkbox in child band on a button click, you could use code similar to the following:
protected void Button1_Click(object sender, EventArgs e)
{
if (WebHierarchicalDataGrid1.GridView.Rows[0].HasRowIslands)
CheckBox cb = (CheckBox)(WebHierarchicalDataGrid1.GridView.Rows[0].RowIslands[0].Rows[0].Items[3].FindControl("CheckBox1"));
if (cb.Checked)
cb.Checked = false;
}
else
cb.Checked = true;
If you are using Load on Demand, you should first make sure the child band is loaded and accessible.
Please let me know if this helps.
Hi Nikolay,
Thanks for your response. I could able to access only first child row with the TemplateDataField using your logic.
Can you please let me know how can I access all the child rows with "CheckBoxes" to set their properties using the below line:
foreach
(ContainerGridRecord appStatusRow in whdgStatusBoard.GridView.Rows)
{}
Or else if there;s any other way?
Thanks,
Pufftuff