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

How to call a javascript function when RadGrid Hierachy Expanding

3 Answers 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Deja vu
Top achievements
Rank 1
Deja vu asked on 17 Sep 2013, 11:16 AM
Hi, 
I want to call a javascript function when user clicks hierarchy expand button. my hierarchyloadmode = serverondemand and i don't want to change to  hierarchyloadmode = client because i takes very long time to load radgrid. in addition my telerik version doesn't support HierarchyLoadMode.Conditional

is there any solution? 

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 20 Sep 2013, 08:30 AM
Hi,

You could use the RegisterStartupScript() method to call a JavaScript function from the code behind. All you have to do is to execute it when ExpandCollapseCommandName has being fired.
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.ExpandCollapseCommandName)
    {
        Page.ClientScript.RegisterStartupScript(GetType(), "Key", "AlertMessage();", true);
    }
}


Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Deja vu
Top achievements
Rank 1
answered on 23 Sep 2013, 10:32 AM
Hi, 
I tried this method before but script runs after the page rendered. I want to  show a loading image on page while the server side method running. 
last week i solved this problem by using telerik:RadAjaxLoadingPanel 

Thanks.
0
Kostadin
Telerik team
answered on 26 Sep 2013, 05:58 AM
Hello,

In this case you could ajaxified you grid and the loading panel will be displayed during the data loading. Please check out the following live example which demonstrates an ajaxified hierarchical grid.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Deja vu
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Deja vu
Top achievements
Rank 1
Share this question
or