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
85
Child Band Sorting on Server side
posted

I am using Infragistics Version 10.3 ,I am binding WebHierarchicalDatagrid using datatable On server side .EnableDataViewState="true" for WebHierarchicalDatagrid ,Structure is parent/child

protected void Page_Load(object sender, EventArgs e)
    {if(!page.ispostback) BindGrid();}

void BindGrid(){

  WebHierarchicalDataSource1.DataViews[0].DataSource = dtList;
                WebHierarchicalDataSource1.DataViews[1].DataSource = ds.Tables[1];

                WebHierarchicalDataGrid.GridView.ClearDataSource();
                WebHierarchicalDataGrid.DataSource = WebHierarchicalDataSource1;
                WebHierarchicalDataGrid.DataBind();
                WebHierarchicalDataGrid.GridView.RequestFullAsyncRender();

}

 I want to apply sorting on Child band ,How can I apply it?

Eagerly waiting for reply.

Thanks,

Parents
No Data
Reply
  • 2501
    posted

    Hello Baron,

    Thank you for submitting your inquiry to the Infragistics ASP.Net Forums.  To enable the Sorting Behavior for the Child Band only in the code behind, use the WebHierarchicalDataGrid InitializeBand event.  In the InitializeBand event, check the Band DataMember to see which Band is currently being Initialized.  If the DataMember is equal to the Child Band DataMember, check if the Sorting Behavior already exists. This will prevent multiple instances of the Sorting Behavior from being added to the grid.  If the Sorting Behavior does not exist for the Child Band, add the Sorting Behavior to the Child Band Behaviors Collection and set the Sorting Behavior to enable.

    The following code snippet demonstrates how this works when the WebHierarchicalDataGrid Child Band DataMember equals "Orders" using the WebHierarchicalDataGrid InitializeBand event:

        protected void WHDG_InitializeBand(object sender, BandEventArgs e)
        {
            if (e.Band.DataMember == "Orders")
            {
                if (e.Band.Behaviors.Sorting == null)
                {
                    Sorting sort = new Sorting();
                    e.Band.Behaviors.Add(sort);
                    sort.Enabled = true;
                }
            }
        }
     
    This functionality may also be enabled using the WebHierarchicalDataGrid Designer where the code for the Sorting is then set for the Child Band Behaviors in the Markup.  The following link is to a sample which may be found in the Infragistics Samples Browser for the WebHierarchicalDataGrid called Sorting on Child Band Level which demonstrates how this is done:

     <http://samples.infragistics.com/2010.3/WebFeatureBrowser/contents.aspx?showCode=true&t=WebHierarchicalDataGrid/WebHierarchicalDataGrid_SortingChildBandClient.aspx~srcview.aspx?path=~srcview.aspx?path=WebHierarchicalDataGrid/WebHierarchicalDataGrid_SortingChildBandClient.src>
     
    Please let me know if this information is helpful or if further assistance is needed.

    Thank you.

    Sincerely,
    Mike D.
    Developer Support Engineer
    Infragistics
    www.infragistics.com/support

Children