open popup window from datagrid

using asp.net (vb), i'm trying to open a popup window from my datagrid's imagebuttons without my page posting back, but for some reason, the page is still posting back ...


Sub dgProject_ItemDataBound(sender as Object, e as DataGridItemEventArgs)
   
Select Case e.Item.ItemType
     Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
     Dim myImageButton As ImageButton
     myImageButton = e.Item.FindControl("ibProjectThumbnail")
     myImageButton.Attributes.Add("onclick", "window.open('login.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
end select

End Sub


can someone suggest what's going wrong?

thanks.
LVL 1
vbnewbie01Asked:
Who is Participating?
 
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
Hi vbnewbie01,

Try

     myImageButton.Attributes.Add("onclick", "window.open('login.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');return false;")

The return false should prevent the postback.

Tim Cottee
0
 
vbnewbie01Author Commented:
nice.  strong work, tim.  thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.