Multimobile Development: Building Applications for any Smartphone
JavaScript Problem: Window.Open
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Jan Zacek
Hi folks,

My problem is that I need to open new window (of some size, tollbars etc.)
by clicking linkbutton. Is it possible? I can't find!

My solution is include JavaScript to source HTML, but then the page cannot
be displayed in Design Mode in VS.NET.

Help please.

Thanx, Jan

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
Ken Cox [Microsoft MVP] (VIP)
You can put something like this in your codebehind file:

Private Sub Page_Load _
(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim sb As New System.Text.StringBuilder()
sb.Append("<script ")
sb.Append("language='javascript'>")
sb.Append("window.open('http://www.aspalliance.com/kenc/hits.aspx',")
sb.Append("'game','toolbar=no,")
sb.Append("addressbar=no,menubar=no,")
sb.Append("width=300,height=300');")
sb.Append("</script>")
RegisterStartupScript("stp", sb.ToString)
End If
End Sub

Ken
MVP [ASP.NET]

"Jan Zacek" <Click here to reveal e-mail address> wrote in message news:uhANjoc1BHA.2856@tkmsftngp05...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Victor Garcia Aprea (VIP)
Hi Jan,

If you dont want to write your javascript at design time, you could do this:

LinkButton1.Attributes.Add("onclick","Javascript:window.open('blah.htm');");

in your Page_Load method,

HTH,
-Victor.

--
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.

"Jan Zacek" <Click here to reveal e-mail address> wrote in message
news:uhANjoc1BHA.2856@tkmsftngp05...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Ken Cox [Microsoft MVP] (VIP)
Oops. You wanted it on a button click. Try this one:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sb As New System.Text.StringBuilder()
sb.Append("<script ")
sb.Append("language='javascript'>")
sb.Append("window.open('http://www.aspalliance.com/kenc/hits.aspx',")
sb.Append("'poll','toolbar=no,")
sb.Append("addressbar=no,menubar=no,")
sb.Append("width=300,height=300');")
sb.Append("</script>")
RegisterStartupScript("stp", sb.ToString)
End Sub

Ken
MVP [ASP.NET]

"Jan Zacek" <Click here to reveal e-mail address> wrote in message news:uhANjoc1BHA.2856@tkmsftngp05...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.EventArgs
System.Object
System.Text.StringBuilder




Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734