Javascript popup within ASP.NET using attributes from a database

Discussion in 'ASP.NET / ASP.NET Core' started by housetouror, Dec 21, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have many popup hyperlinks being accessed from a datalist that all have different attributes (width, length, toolbar, menubar, etc.). Rather than create a seperate javascript function for each popup, which would seem rather redundant, I would like to bind a database field for each attribute.

    Trying to bind the fields within the ASP.NET tag in the NavigateUrl property was completely unsuccessful. I had no luck calling the databound fields within a javascript function either. Are there any brilliant ideas out there? I've tried creating a Resize/Redirect page for each hyperlink, but the popup blockers get the user stuck on that page.

    This is what I have now:


    Heres the tag:
    <asp:DataList id="DataList1" runat="server">
    <ItemTemplate>
    Tour:&amp;nbsp; <asp:Label id="Label1" runat="server" text='<%# DataBinder.Eval(Container.DataItem, "House") %>'></asp:Label>&amp;nbsp;&amp;nbsp;&amp;nbsp;
    <asp:HyperLink runat="server" target="_blank" NavigateUrl='<%# "Javascript:OpenMyWindow(""" &amp; DataBinder.Eval(Container.DataItem,"Hyperlink") &amp; """, " &amp; DataBinder.Eval(Container.DataItem, "house") &amp; ", " &amp; DataBinder.Eval(Container.DataItem,"width") &amp; ", " &amp; DataBinder.Eval(Container.DataItem, "height") &amp; ", " &amp; DataBinder.Eval(Container.DataItem, "toolbar") &amp; ", " &amp; DataBinder.Eval(Container.DataItem, "menubar") &amp; ");" %>' ID="Hyperlink1">view</asp:HyperLink>
    </ItemTemplate>
    </asp:DataList>
    Here's the Javascript:
    <function OpenMyWindow(Hyperlink, House, Width, height, toolbar, menubar)
    {
    window.open(Hyperlink, House, Width, height, toolbar, menubar)
    }
    Thanks
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page