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.
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.