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

Calling Javascript After RowDrop

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 25 Feb 2011, 01:50 AM
We're using the Grid_RowDrop EventHandler to perform a few operations after a row is dropped from one grid to another. The only issue we've run into is that we need to dynamically change some text outside of the two grids after the drop occurs. One possible way to do this would be with some Javascript, but while it's easy to call Javascript before the drop finishes with OnRowDropping and OnRowDropped, I can't find a way to call Javascript after the Grid_RowDrop EventHandler completes. If there's a way to do this, it would be great to know.

On the other hand, if it's better to update this text from within the Grid_RowDrop EventHandler itself by putting the text in a control (RadAjaxPanel maybe?), that would work too. We'd appreciate some advice either way on the best solution to this problem. Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 25 Feb 2011, 11:02 AM
Hello Mike,

Both of the suggested approaches would work. You can update a control or element on the page either through javascript added to the response scripts after an AJAX postback, or straight from inside RadGrid's RowDrop event handler.

To emit javascript from the server on RadGrid's RowDrop event, use the ScriptManager.RegisterStartupScript method. It will register a script that will be executed after the page loads in the browser.

You can also update the control on the server from inside the RowDrop event handler. If you are using AJAX, note that either both RadGrid and the updated control need to be in one and the same AJAX-updated container, or, if using RadAjaxManager, you need to register an AJAX setting specifying RadGrid updates your control:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="[UpdatedControlID]" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>


Veli
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Mike
Top achievements
Rank 1
answered on 25 Feb 2011, 04:30 PM
Excellent, nice and easy. Thanks!
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Veli
Telerik team
Mike
Top achievements
Rank 1
Share this question
or