We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


How to reload page in VB.Net using a click event

avi4 asked
Medium Priority
Last Modified: 2012-06-22

I have a web form with a button that when a user clicks on a button it should insert report values
into database. On my form I also use a data list to show all the reports that were
created by the user. So my question would be how can you reload a page in VB.NET that when  
user will click the button it would show all the current reports plus the newest one.


For example:

so on ...

<asp:button id="btnInsert" style="Z-INDEX: 103; LEFT: 352px; POSITION: absolute; TOP: 88px"
runat="server" Width="161px" Text="Create Report"></asp:button>
Watch Question

at the end of your sub button_click event add this:

Me.RegisterStartupScript("MyKey", "<script language='javascript'>window.location.reload();</script>")

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
The page should reload itself when you click any <asp:button> unless you are using output caching.
As bsdotnet said, the page will be posted back when the button click event will be fired. In the button_click event, you can call the datalist databinding method to show the update records e.g.:

Private sub Button1_Click(sender as object, e as eventargs)Handles Button1.Click
end sub


If you want to reload the page without submitting the page then you can use vbscript or javascript in you page to create the XMLHTTP object and do a post to the aspx page that adds the new report to the database and returns the updated colletion of reports. The response can be handled in the script to show the report list



Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.