Embed code doesn't evaluate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • z1freeride
    New Member
    • Feb 2009
    • 36

    Embed code doesn't evaluate

    I've found out that I can't do this:
    Code:
    OnClientClick='var a = <%# DataBinder.Eval(Container.DataItem, "field") %>;'
    Doing that just outputs the text and does not evaluate what's in the server tag.

    How do I correctly evaluate that expression so that it outputs the contents of the data?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    All you appear to be doing in that statement is creating a local javascript varriable a and assigning it some value. Even if the statement was eval'd, it would still do nothing.
    What are you trying to achieve?

    Comment

    • z1freeride
      New Member
      • Feb 2009
      • 36

      #3
      I simplified the code to focus on only one issue. The javascript that I have on my live page is a lot longer and works fine. I'm just trying to get the embed code working.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Well the reason I asked is because you set the javascript onclick attribute in the "code" file instead of trying to do it in the aspx file

        Comment

        Working...