How can I update a DataSource in runtime?
I have a dropdown list which retrieves data from a datasource. I must to 开发者_开发问答update the dropdown when I add new data to the database through another page. I've not found documentation for this kind of updating, that would be like the requery
method on DAO databases for VB6.
it really depends on how you have designed your page, you could refresh the page with a refresh button or with the refresh of the browser or even via JavaScript which reloads your page every x minutes, then you will query again everything because the page will have a full life cycle again.
if you want to do more sophisticated things you can of course use Ajax ( PageMethods or UpdatePanel approaches ) to have a partial render.
Using the databind method for the dropdown will force the update of the control. But the combo will be updated only when the page is reloaded. Maybe the best way should be using Ajax...
精彩评论