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

how to avoid refresh problem in radgrid

1 Answer 309 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 24 Nov 2010, 08:26 AM
Hi,

I have big problem in my application.

first i am inserted record in my application using Add New Record option in radgrid. it is inserted correctly. but then i clicked refresh button in IE8 browser. the same record inserted another time. it is a big problem for me.

Please give me a tips for how to resolve it.


Thanks,
Dhamu.

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 24 Nov 2010, 01:19 PM
Hello dhamodharan,

You can redirect the page after insertion. This way when hitting F5, the data will not be inserted second time.

If you have page MyPage.aspx that contains RadGrid, for instance:

Attach function to ItemInserted event of the grid
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" oniteminserted="RadGrid1_ItemInserted" .....>
   ....
</telerik:RadGrid>

Then on ItemInserted event, redirect to the same page.
protected void RadGrid1_ItemInserted(object sender, Telerik.Web.UI.GridInsertedEventArgs e)
{
    Response.Redirect("MyPage.aspx");
}

For additional information check the links bellow.
http://en.wikipedia.org/wiki/Post/Redirect/Get
http://stackoverflow.com/questions/2526568/asp-net-prevent-form-submission-twice

Greetings,
Vasil
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or