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


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>
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

at the end of your sub button_click event add this:

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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

avi4Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.