0

I have one asp.net page with two gridview using updatepanel.when i click the submit button data inserting in db and update the gridview. i'm handling duplicate insertion of same data when refresh the page. but the problem is when i refreshing the page previous data in the gridview showing not present data. again if i'm clicking the menu its reloading and showing actual data.i'm handling button click but i don't know how to handle this gridview problem when i refresh the page. if anybody pass through same problem please show some light on this or please give some suggession.

nichu09
  • 882
  • 2
  • 15
  • 44

3 Answers3

0

I would try:

gridviewObj.datasource = null
gridviewobj.datasource.databind();

... hope this helps

Shanyman
  • 41
  • 6
  • Suggestions of things to try aren't really answers. If you're sure this is the issue, then please provide an explanation and not just a code snippet. – Mike Precup Jul 18 '14 at 15:44
0

you could do this

protected void Page_Load(object sender, EventArgs e)
    {
    if (Page.IsPostBack)
    {
    //here you bind again the datagrid
    }
    }
Randall Sandoval
  • 237
  • 1
  • 6
  • 21
0

Use if(IsPosback) in Page_Load event
then
UpdatePanel.Update();