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
685
Expand row by code
posted

I have a page with a WebHierarchicalDataGrid displaying 2 band levels. The page may receive a querystring parameter which identify a row (primary key) on the first band to be expanded. How can I make the row expand on page load ? Should this be done In server code or javascript ? Please help.

Thanks.

Parents
  • 33839
    Verified Answer
    posted

    Hey,

    I'm not sure whether you mean to expand a root row or a row in level one, but that shouldn't matter too much, unless you are also using LoadOnDemand, which would make it hard on the client.  To expand a row on the client, try the following.

    function init(grid, args) {
                var grid = $find("WebHierarchicalDataGrid1");
                grid.get_gridView().get_rows().get_row(1).set_expanded(true);
            }

    <ClientEvents Initialize="init" />

    If you would rather do it on the server, I did it in the WebHierarchicalDataGrid's DataBound event.

    protected void WebHierarchicalDataGrid1_DataBound(object sender, EventArgs e)
        {
            this.WebHierarchicalDataGrid1.GridView.Rows[1].Expanded = true;
        }

    Let us know if you need more help.

    regards,
    David Young

Reply Children
No Data