Hey guys I have a post back url that I using to link to a webpage of maps from a database but instead of opening the link in a new windows it just opens it in the same windows pls help I am a rockie


code

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

Button1.PostBackUrl = "WebMap/default.asp?map=1&params=type:gdo!connection:Map%20Data%20SQL!table:Building!field:BldgNumber!value:" & DropDownList1.SelectedValue

End Sub
Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs)

End Sub

Protected Sub Department_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs)


End Sub

Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

Button2.PostBackUrl = "Aworking/default.asp?map=1&params=type:gdo!connection:Map%20Data%20SQL!table:DeptInfo!field:RoomLocID!value:" & DropDownList2.SelectedValue
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)

End Sub

a couple ways you can do it, one would to include javascript which I would ignore if you can.

Another way is to put "<base target="_blank"></base>" inbetween your head tags, but this may affect other links on your page depending on how you coded them.

Another way is to put OnClientClick="form1.target='_blank'" in your button control along with the PostBackUrl="..."

The code to open a new windows in javascript is

'Open in new window
Dim OpenNewPage As String
OpenNewPage = "<script type='text/javascript'>detailedresults=window.open('NewPage.aspx');</script>"
ClientScript.RegisterStartupScript(Me.GetType(), "", OpenNewPage)

but beware that it gets caught in Firefox & IEs Popup Blockers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.