简体   繁体   中英

Using ASP.NET UpdatePanel with SqlDataSource

I'm currently involved in adapting an existing website. In the website we have a page that uses a formview and some SqlDataSources to get data from the database.

On this website I need to have a link that will start an action (this is no problem) on the server. When the particular action has been completed the database will be updated.

Now if the user is still on that page I want it to have it updated. But the only thing that needs to be updated is the status and it's message next to the link. This what I think of doing:

Using an updatepanel and having a "constant" (with timed intervals) check on the database to see wether or not the database has been updated. If it has, the part with the status will be refreshed. The problem I think of is, how can I force the SqlDataSource to get the new data from the database when the check returns a 'go'?

If possible it would be nice to only have a certain part of the SqlDataSource refresh. If you need anymore information, just ask.

Any comment will be appreciated. Kind regards, Floris

You just need to call the DataBind method of the FormView and it will bind the New Data. In this way your SQLDataSource will get the updated data from the DB.

FormView1.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