This is a migrated thread and some comments may be shown as answers.

[Solved] Load Hierarchical Grid On ButtonClick

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Johannes Arevärn
Top achievements
Rank 1
Johannes Arevärn asked on 15 Sep 2009, 09:52 AM
Hi!

In my page I have a couple of comboboxes, a grid and a button. The structure of the grid is a three-level hierarchy: Properties -> Buildings -> Objects. The datasource of the grid is specified from choices the user has made from the comboboxes. Its not an option to load all items clientside because when an item is expanded i need to run some checks and maybe modify the items. When the button is clicked the LoadGrid method fires and loads the grid with the correct datasources, one datasource for every level in the hierarchy. Because of the grid loading in the buttonclick-event the datasource disappears for example when i try expanding an item.
How can I persist the datasource of the grid?

I have tried to load the grid in the Page_Init event, as in the example http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html,  which works fine but then i will not be able to filter the datasource from the comboboxes.

The structure of the grid is created as in the example above with the only difference that the method fires in the ButtonClick event instead of the Page_Init event.

Regards, Johannes


1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 18 Sep 2009, 09:30 AM
Hi Johannes,

I recommend that you set a asp:HiddenField on client click of the button and check its value in the Page_Init event handler and load the grid if necessary:
    protected void Page_Init(object sender, EventArgs e)  
    {  
        if (ValueHiddenField.value == "Load Grid")  
            LoadGrid();  
    }  

All the best,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Johannes Arevärn
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or