Open new window from image button

tiffany

Well-known member
Joined
Aug 7, 2005
Messages
57
Programming Experience
1-3
Hi, can i know how to open new window from image button in a datagrid?

Currently, i had this codes for html page:

<asp:TemplateColumn HeaderText="Image">
<ItemTemplate>
<asp:ImageButton Width="150" Height="125" CommandName="Select" ImageUrl=
'<%# DataBinder.Eval(Container.DataItem, "pic") %>' Runat=server ID="Image1"/>
</ItemTemplate>
</asp:TemplateColumn>

This is my code behind:

Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
Dim image1 As ImageButton
'If e.CommandName = "Select" Then
image1.Attributes("onclick") = ("<script>window.open" & "('h_viewTest.aspx','_new', 'width=400,height=200');</script>")
' End If
End Sub


tiffany.
 
Hi, thank for your reply. I had chnaged the sentance to this:

image1.Attributes.Add("onClick", "<script>window.open" & "('h_viewTest.aspx','_new', 'width=400,height=200');</script>")

But there is no new window popping out. Is this corect?


tiffany.
 
Back
Top