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
523
BUG? WHDG error on bind
posted

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.