Thanks for the reply. After some trial and error I have finally worked out what it meant and will share it with anyone else who might what to do the same thing :-
Method 1.
Add this javascript code through Attributes.Add(), in the handler for the button use Response.Write() to send it back to the browser :-
In this example I have a button (Button2) to open a new window for my photo album.
In the code behind :-
Partial Class DefaultVb
Inherits System.Web.UI.Page
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Response.Write(" ")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Button2.Attributes.Add("onclick", "window.open('http://www.braybrookefc.co.uk/Match/PhotoAlbumVb.aspx', 'popupwindow', 'width=800,height=600,scrollbars,resizable')")
'Button2.Style.Add("background-color", "red")
End Sub
End Class
In the .aspx file
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Goto Album" Font-Bold="True" ForeColor="Red" BorderColor="Blue" BorderStyle="Outset" BorderWidth="2px" BackColor="White" />
Method 2.
Use an html button and wire up this code for the onClick event :-
In this example, I wanted to open a new window when a link to another website is selected.
<asp:Hyperlink ID="Hyperlink1" Runat="server"
NavigateUrl="http://www.eastberkshirefootballleague.co.uk/"
onclick="window.open (this.href, 'popupwindow',
'width=800,height=600,scrollbars,resizable');
return false;">East Berks Football League Website
</asp:Hyperlink>
I hope this can help.
Andy M
|