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
235
How to get the band for Row?
posted

We are using the WHDG from version 13.2. Below get called on initialization of each row.

Private Sub dgGrid_InitializeRow(ByVal sender As Object, ByVal e As RowEventArgs) Handles dgGrid.InitializeRow

…..

End Sub

On InitilizeRow event we do get each row. We do alter each column from the row to assign hyperlinks & assign javascript to it.

How to identify the band for current row?

Thanks!

Parents
No Data
Reply
  • 20255
    Offline posted

    Hello Parikshit,

    Thank you for contacting us.

    You can get the Rows collection and from there to get the specific row and access its RowIslands collection. You can use the Row Index in order to get the desired row.

    protected void WebHierarchicalDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
    {
        //(sender as WebHierarchicalDataGrid).GridView.Rows[e.Row.Index].RowIslands[0]
    }

    Other ways how to access the child bands can be found into the attached sample:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Data"] == null)
        {
            Session["Data"] = populateGrid();
            this.WebHierarchicalDataGrid1.InitialDataBindDepth = 1;
            this.WebHierarchicalDataGrid1.DataSource = Session["Data"];
            this.WebHierarchicalDataGrid1.DataBind();
     
            int firstRowIslandsCount = this.WebHierarchicalDataGrid1.GridView.Rows[0].RowIslands.Count;
            int childRowCount = this.WebHierarchicalDataGrid1.GridView.Rows[0].RowIslands[0].Rows.Count;
     
            resultLbl.Text += firstRowIslandsCount + " and have " + childRowCount + " child rows";
        }
        else
        {
            this.WebHierarchicalDataGrid1.DataSource = (DataSet)Session["Data"];
        }
    }
     
    protected void WebHierarchicalDataGrid1_RowIslandsPopulated(object sender, Infragistics.Web.UI.GridControls.ContainerRowEventArgs e)
    {
        //get the first row items collection
        Session["FirstChildRowItems"] = e.Row.RowIslands[0].Rows[0].Items;
    }



    Let me know if I may be of further assistance.

    GetBandExample.zip
Children