Kallumasaurus
Kallumasaurus

Reputation: 271

Redirecting a page into the same tabbed window using JavaScript?

I have a problem , I am quite new to this whole coding in cross languages , basically when I click on a row index in my GridView it then opens a new tab and brings in the results in that window ( The new one that has just opened ) and I know this is from using the Window.Open but I am wondering is there a function that I can use to just open my results in the actual same window from where it is being clicked? something like Window.Open <Open in same window>? My code is below.

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.Cells(1).Attributes("onmouseover") = "this.style.cursor='hand';this.style.textDecoration='underline';" e.Row.Cells(1).Attributes("onmouseout") = "this.style.textDecoration='none';" Dim Index As Integer = e.Row.RowIndex e.Row.Cells(1).Attributes("OnClick") = "window.open('MachineSweepLite.aspx?AreaID=" + GridView1.DataKeys(e.Row.RowIndex).Values("ID").ToString + "');" End If End Sub

Please make your answers Clear as possible for me to understand.

Upvotes: 0

Views: 92

Answers (1)

King of kings
King of kings

Reputation: 695

Instead of window.open() use window.location.href like the following

 window.location.href = 'http://www.google.com';

Upvotes: 1

Related Questions