I have q grid like this
<ig:WebHierarchicalDataGrid ID="grid" runat="server" Height="400px" Width="99%" DataKeyFields="IdModulo" AutoGenerateColumns="False" EnableDataViewState="True" OnInitializeRow="gridJerarquicoModulos_InitializeRow"> <Columns> <ig:BoundDataField DataFieldName="IdModulo" Hidden="True" Key="IdModulo"> <Header Text="IdModulo" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Nombre" Key="Nombre"> <Header Text="Nombre" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Codigo" Key="Codigo"> <Header Text="Código" /> </ig:BoundDataField> </Columns> <Bands> <ig:Band DataKeyFields="IdModuloVersion" AutoGenerateColumns="false" DataMember="Versiones"> <Columns> <ig:BoundDataField DataFieldName="IdModuloVersion" Hidden="True" Key="IdModuloVersion"> <Header Text="IdModuoVersion" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="IdModulo" Hidden="True" Key="IdModulo"> <Header Text="IdModulo" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Version" Key="Version"> <Header Text="Versión" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="FechaInicioModulo" Key="FechaInicioModulo"> <Header Text="Inicio" /> </ig:BoundDataField> <ig:TemplateDataField Key="Vigente"> <ItemTemplate> <asp:CheckBox ID="chkVigente" runat="server" Enabled="False" /> </ItemTemplate> <Header Text="Activo" /> </ig:TemplateDataField> </Columns> </ig:Band> </Bands> <Behaviors> <ig:RowSelectors EnableInheritance="true" RowNumbering="true"> </ig:RowSelectors> <ig:Activation> </ig:Activation> <ig:Selection CellClickAction="Row" RowSelectType="Single" Enabled="True"> </ig:Selection> </Behaviors>
</ig:WebHierarchicalDataGrid>
And my code behind to bind the grid is:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { datasourceH.DataViews.Add( new DataView() { ID = "Modulos", }); datasourceH.DataViews.Add( new DataView() { ID = "Versiones", }); datasourceH.DataRelations.Add(new DataRelation("Modulos", "IdModulo", "Versiones", "IdModulo"));
datasourceH.DataViews[0].DataSource = ColModulos; //ColModulos is IList datasourceH.DataViews[1].DataSource = ColVersionesModulos; //ColVersionesModulos is IList grid.DataSource = datasourceH; grid.DataBind(); } }
protected void gridJerarquicoModulos_InitializeRow(object sender, RowEventArgs e) { if ((e.Row.DataItem as WebHierarchyData).Item is ModuloVersion) { (e.Row.Items[4].FindControl("chkVigente") as CheckBox).Checked = ((e.Row.DataItem as WebHierarchyData).Item as ModuloVersion).Vigente; } }
After the grid is loaded, when I expand the first parent row, no problems, but when I try to expand the second parent row I get an error "Unable to cast 'Infragistics.Web.UI.Framework.Data.DataRecord' to 'System.Web.UI.IHierarchyData'."
Thanks in advance for any help. Please I need this urgent, I have a presentation today.
Hello Alejandro,
I have tested the issue with the latest service release and it is not reproduicble (v10.3.20113.2105). I suggest download and upgrade your toolset.
Thanks
Thank you for pointing this issue out to us. I will investigate it further. As a temporary workaround you can set EnableDataViewState = false and supply datasouce on each postback.