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

Prevent PostBack after edit/delete in Grid

7 Answers 731 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 22 Oct 2012, 07:28 AM
Hello,
if I press edit / update / delete in RadGrid, it will make a PostBack and the Page jumps to the Top.
This is not so nice if you have a lot of data and have to scroll / fin your line again ...

So how can I prevent RadGrid to make a PostBack to the Page?
Like on this example. (Do PageSize 50, scroll down to the last lne and press edit / update)

Best regards
Benjamin

7 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Oct 2012, 11:08 AM
Hello,

Please add below code snippet.

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


Thanks,
Jayesh Goyani
0
Benjamin
Top achievements
Rank 1
answered on 22 Oct 2012, 11:21 AM
Hello Jayesh,

I already had an RadAjaxManager included, but not with that settings.
Thanks for your solution, works fine. (after 2nd try lol)

greetings Benjamin
0
Barry P
Top achievements
Rank 1
answered on 05 Feb 2013, 03:54 PM
I'm handling Ajax manually, and not using the RadAjaxManager.  Is this necessary to ALWAYS prevent a delete from doing a postback?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 06 Feb 2013, 04:43 AM
Hello,

Can you please elaborate your scenario?

Thanks,
Jayesh Goyani
0
Barry P
Top achievements
Rank 1
answered on 06 Feb 2013, 01:20 PM
My scenario is very simple.  I do client-side databinding for loading the grid, but everything else is manual Ajax calls to perform database updates, and I reflect changes in the grid as needed.  So, when a user deletes a "thing", I want to delete the row in the grid without the page doing a postback.  I've decided to just hide the row, but I'm surprised that a delete to a row forces a postback since we're all focused on performing functions via Ajax.
0
Eyup
Telerik team
answered on 08 Feb 2013, 09:46 AM
Hi Barry,

You can use a GridClientDeleteColumn column to achieve the requested behavior:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/clientdelete/defaultcs.aspx

You can also check the following example:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/insertupdatedelete/defaultcs.aspx

I hope this helps.

Greetings,
Eyup
the Telerik team
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 their blog feed now.
0
Barry P
Top achievements
Rank 1
answered on 08 Feb 2013, 03:36 PM
This is helpful.  Thank you.
Tags
Grid
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Benjamin
Top achievements
Rank 1
Barry P
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or