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

[Solved] First time hierarchy-expand with OnRequestStart

2 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel Lang
Top achievements
Rank 1
Daniel Lang asked on 24 Feb 2010, 01:20 AM
Dear All!

I'm encountering a really strange behaviour:
I have a RadGrid on my page, which displays a two-level hierarchy. OnNeedDataSource and DetailTableDataBind - events are used for assigning data to the grids. Additionally there is an AjaxManager, which updates the grid itself and a further dependent RadGrid (unimportant). HierarchyLoadMode is set to "ServerOnDemand". Data insertion/deletion/updating is done with the default in-line editors (server-side events aren't implemented yet). So far, nothing special at all...

Everything worked fine, until I added export-buttons into the command-item. I have read the documentation carefully and therefor added the javascript-method to un-ajaxify the 3 export-buttons.

Here is the code:
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
        <script type="text/javascript"
            function mngRequestStarted(ajaxManager, eventArgs) { 
                if (eventArgs.get_eventTarget().indexOf("btnExportToPDF") != -1) 
                    eventArgs.set_enableAjax(false); 
                if (eventArgs.get_eventTarget().indexOf("btnExportToExcel") != -1) 
                    eventArgs.set_enableAjax(false); 
                if (eventArgs.get_eventTarget().indexOf("btnExportToCSV") != -1) 
                    eventArgs.set_enableAjax(false); 
            } 
        </script> 
    </telerik:RadCodeBlock>   

This client-side function is registered like the following:
    <telerik:RadAjaxManager runat="server" EnablePageHeadUpdate="False" ClientEvents-OnRequestStart="mngRequestStarted"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="gridTasks"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="gridTasks"/> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="gridTasks" EventName="OnSelectedIndexChanged"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="lblNoSelectionText" /> 
                    <telerik:AjaxUpdatedControl ControlID="pnlTimeEntryPanel"/> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="chkShowProj... 
 
 ### further code ### 

The problem:
If I open up the page in a web-browser and want to expand any record immediately, it doesn't work as long as I don't click a second record, or do anything which triggers an ajax-request!
For example: Before I can expand any record, I could click on it, so that there is a SelectionChangedEvent being raised (ajax-request is ok) and after that everything is normal.

My solution-attempt:
If I remove the "ClientEvents-OnRequestStart" - from the AjaxManager-definition everything is ok. Therefor I believe it must have something to do with the initial registration of the javascript-functions which make a record expand or collapse.

Any help or tips appreciated!

Best regards,
Daniel Lang

2 Answers, 1 is accepted

Sort by
0
Daniel Lang
Top achievements
Rank 1
answered on 24 Feb 2010, 02:40 PM
In the meantime I can guerantee, that the javascript-function "mnqRequestStart" is executed correctly on every "expand"-event. I tested it with FireBug. Further I know, that also the ajax-request to the server is happening and served correctly (debugging the needdatasource and itembound - methods with visual studio). Therefor I assume that this is a bug which has something to do with the RadGrid not being updated client-side in some cases when using the ClientEvents-OnRequestStart.

BTW: I switched to HierarchyLoadMode="Client" and now everything is working again. However, I think this bug should be fixable.
0
Veli
Telerik team
answered on 26 Feb 2010, 10:44 AM
Hello Daniel,

I cannot seem to reproduce this behavior. Have you tried with the built-in export buttons in the command item? You can check out this RadGrid demo for that. Let me know how it goes.

Sincerely yours,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Daniel Lang
Top achievements
Rank 1
Answers by
Daniel Lang
Top achievements
Rank 1
Veli
Telerik team
Share this question
or