0 Replies - 1595 Views - Last Post: 01 August 2013 - 03:31 AM Rate Topic: -----

#1 tabisaki   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-June 13

How do I stop a web page loading and reload the previous page

Posted 01 August 2013 - 03:31 AM

I have a website with gridview populated from a SQL database.
I have put some code to confirm that the gridview is actually created by checking to see if any rows have been created.
If no rows have been created it displays a message box that informs the user that there are no records to display.
I am now struggling to see how I can get it to stop loading the page (which will be blank) and instead reload the previous page.
My idea is to perform a click on the btnBack button which has the URL information for the previous page already stored.
Unfortunately due being a bit thick I can't see how to perform the button click in code.
This is the code I currently have:
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'get previous page info for back button
        btnBack.Attributes.Add("onclick", "javascript:history.back(); return false;")
        'If no rows created in Gridview then tell user that no data available
        If GridView1.Rows.Count = 0 Then
            MsgBox("There are no video files in this directory", MsgBoxStyle.MsgBoxSetForeground, "No Video Files")
            If MsgBoxResult.Ok Then
                'Here is where I am trying to perform a click on btnBack or reload the previous page
                'This is where I'm stuck
            End If
        End If
    End Sub

Any pointers would be gratefully received.


Is This A Good Question/Topic? 0
  • +

Page 1 of 1