Hyperlink on a datagrid

A

ashtek

Hi,
I am using a hyperlink on a datagrid (templatecolumn) to display a
link. Onclick of this link I want to open a new window without tool bar
& with certain width & height.
I am using this code

<ASP:TEMPLATECOLUMN HEADERTEXT="Details">
<ITEMTEMPLATE>
<ASP:HYPERLINK ID="lnkDetails" RUNAT="server" NAVIGATEURL='<%#
"Details.aspx?ID=" + DataBinder.Eval(Container.DataItem,"ID")%>'
TARGET="_blank" TEXT="Details"></ASP:HYPERLINK>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN>

This opens a new window but with toolbar & default width & height.

I also tried the following:

NAVIGATEURL="javascript:window.open('Details.aspx?ID=" + <%#
DataBinder.Eval(Container.DataItem,"ID")%> +
"','width=500,height=500,toolbar=no');"

but it says "The server tag is not well formed."

Can anyone tell me how to open a customized window when I click on
<asp:hyperlink> ?

Thanks,
Ashish.
 
A

ashtek

I found out the solution.

Add the attribute ONCLICK to <asp:hyperlink

<ASP:HYPERLINK ID="lnkDetails" RUNAT="server" NAVIGATEURL='<%#
"Details.aspx?ID=" + DataBinder.Eval(Container.DataItem,"ID")%>'
ONCLICK="javascript:window.open('',target,'toolbar=0,width=600,height=600,scollbars=1')"
TARGET="target" TEXT="Details"></ASP:HYPERLINK>

This works fine!

-Ashish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top