Question

I am trying to create a popup window when clicked the hyperlink. Currently, my hyperlink is opening the entire page which is huge and i would like to make like a pop up, smaller size. How can i do that? Here is my code:

    <asp:TemplateField>
     <ItemTemplate>
      <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# Eval("ID", "~/DET/Policy.Merket?ID={0}") %>' Target="_blank">POLICY</asp:HyperLink>

   </ItemTemplate>
     </asp:TemplateField>

i come back just to post the solution in case someone needs:

`<asp:Hyperlink Runat="server" NavigateUrl='<%# Eval("ID", "~/DET/Policy.Merket?ID={0}") %>' onclick="window.open (this.href, 'popupwindow',  'width=400,height=400,scrollbars,resizable'); return false;">Link text goes here<asp:Hyperlink>`
Was it helpful?

Solution

You could use the javascript window.open() function in a pure HTML button. Copying from here, you can see an example defining the popup window size etc.

<a href="#" onClick="window.open("http://www.w3schools.com","_blank","toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");return false">Link text</a>

Another alternative would be to use jQuery and specifically the overlay tool.

Hope I helped!

OTHER TIPS

use the ajaxtoolkit modalpopup

it will much more helpfull for you

thanks,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top