简体   繁体   English

当刷新浏览器先前在asp.net的gridview中加载的数据时

[英]When Refresh the browser previous data loading in gridview in asp.net

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. 当我单击插入数据库中的提交按钮数据并更新gridview时,我使用updatepanel有一个asp.net页和两个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. 但是问题是当我在gridview中刷新页面上的数据时显示不存在数据。 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. 再次,如果我单击菜单,它会重新加载并显示实际数据。我正在处理按钮单击,但是当我刷新页面时,我不知道如何处理此gridview问题。 if anybody pass through same problem please show some light on this or please give some suggession. 如果有人遇到相同的问题,请对此加以说明或提出建议。

I would try: 我会尝试:

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

... hope this helps ... 希望这可以帮助

you could do this 你可以这样做

protected void Page_Load(object sender, EventArgs e)
    {
    if (Page.IsPostBack)
    {
    //here you bind again the datagrid
    }
    }

Use if(IsPosback) in Page_Load event 在Page_Load事件中使用if(IsPosback)
then 然后
UpdatePanel.Update(); UpdatePanel.Update();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM