简体   繁体   中英

Refresh a view in asp.net

I have a GridView that pulls data from a SQL query on an asp.net page. When the page loads, the query will return no results until all the elements of the page are completed.

How can I use a button (or any other method) to refresh the view once I have completed the rest of the page?

Thank you!

Rebind to the grid again once you are done with all your page load like

gridview1.DataSource = <some data source>;
gridview1.DataBind();

try this code.

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
               gridview1.DataSource = <some data source>;
               gridview1.DataBind();  
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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