Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 856
  • Last Modified:

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

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>
0
avi4
Asked:
avi4
4 Solutions
 
aki4uCommented:
at the end of your sub button_click event add this:

Me.RegisterStartupScript("MyKey", "<script language='javascript'>window.location.reload();</script>")
0
 
bsdotnetCommented:
The page should reload itself when you click any <asp:button> unless you are using output caching.
0
 
nauman_ahmedCommented:
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.
0
 
spattewarCommented:
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
0
 
avi4Author Commented:
Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now