HyperLink + Javascript + DataItem=Problems

Discussion in 'ASP .Net' started by Elmo Watson, Nov 19, 2005.

  1. Elmo Watson

    Elmo Watson Guest

    Ok - I've got a datalist - in the template, there is a hyperlink, in which,
    I need to dynamically use the record's ID inside a Javascript function (a
    popup window function, which works perfectly with implicit ID)

    The problem I think, is where to put the single and double quotes - I get a
    The server tag is not well formed
    error.

    Here's the last one that didn't work:
    <asp:Hyperlink id="hyLink"
    NavigateURL="Javascript:OpenIt('comments.aspx?id=<%#
    Container.DataItem("id")' %>)" Text="Comments" Runat="server" />

    as I said, the OpenIt function works fine, as long as there's no dynamically
    generated id...
    I've tried removing the Outer double quotes from the NavigateURL property,
    along with several other combinations - but I still get the error.

    Any ideas?
    Elmo Watson, Nov 19, 2005
    #1
    1. Advertising

  2. Elmo try looking at this sample by Scott at:-
    http://datawebcontrols.com/faqs/Hyperlinks/HyperlinkWithMultipleQuerystringV
    alues.shtml
    or
    http://datawebcontrols.com/faqs/Hyperlinks/HyperlinkThatOpensInANewWindow.sh
    tml
    It should guide you
    Hope that helps
    Patrick


    "Elmo Watson" <> wrote in message
    news:...
    > Ok - I've got a datalist - in the template, there is a hyperlink, in

    which,
    > I need to dynamically use the record's ID inside a Javascript function (a
    > popup window function, which works perfectly with implicit ID)elps


    >
    > The problem I think, is where to put the single and double quotes - I get

    a
    > The server tag is not well formed
    > error.
    >
    > Here's the last one that didn't work:
    > <asp:Hyperlink id="hyLink"
    > NavigateURL="Javascript:OpenIt('comments.aspx?id=<%#
    > Container.DataItem("id")' %>)" Text="Comments" Runat="server" />
    >
    > as I said, the OpenIt function works fine, as long as there's no

    dynamically
    > generated id...
    > I've tried removing the Outer double quotes from the NavigateURL property,
    > along with several other combinations - but I still get the error.
    >
    > Any ideas?
    >
    >
    Patrick.O.Ige, Nov 19, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lauchlan M
    Replies:
    1
    Views:
    7,215
    Lauchlan M
    Oct 15, 2003
  2. VB Programmer
    Replies:
    0
    Views:
    376
    VB Programmer
    Feb 11, 2005
  3. davetichenor
    Replies:
    1
    Views:
    808
    Eliyahu Goldin
    Oct 30, 2006
  4. Ken
    Replies:
    1
    Views:
    363
    Alvin Bruney
    Aug 16, 2003
  5. Dave
    Replies:
    0
    Views:
    927
Loading...

Share This Page