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

x

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

avi4
avi4 asked
on
Medium Priority
895 Views
Last Modified: 2012-06-22
Hi,

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.

Thanks!

For example:

06/20/2005
06/25/2005
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>
Comment
Watch Question

Commented:
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
Commented:
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
 BindDataList()
end sub

-Nauman.
CERTIFIED EXPERT
Commented:
Hi

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

-$wapnil

Author

Commented:
Thanks!
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.

OR

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.