OnClientClick pass parameter from databinding

Discussion in 'ASP .Net' started by Randy, Apr 10, 2006.

  1. Randy

    Randy Guest

    Hi,

    I am trying to do something like this:


    <asp:Button ID="cmdExploder" runat="server"
    OnClientClick='javascript:ButtonPressed(<%# Container.DataItem %>);'
    Text="testing" />


    Of course this is a little simplistic. Assume this code is in a
    datalist and the databinding will be the primary key of some record.
    The purpose is to give the client side javascript the ID.

    The problem I am having is that I can't figure out how to wrap the <%#
    %> stuff properly with quotes or whatever. It doesn't actually databind
    it just shows the literal in the page source.

    Any thoughts?

    thanks in advance.

    Randy
     
    Randy, Apr 10, 2006
    #1
    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. Nathan Sokalski
    Replies:
    3
    Views:
    7,532
    Teemu Keiski
    Aug 1, 2007
  2. jobs
    Replies:
    0
    Views:
    1,677
  3. Earl Teigrob
    Replies:
    1
    Views:
    422
    Shravan
    Mar 1, 2004
  4. Nathan Sokalski

    Problem with ImageButton.OnClientClick when DataBinding

    Nathan Sokalski, Jul 31, 2007, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    749
    Teemu Keiski
    Aug 1, 2007
  5. AzamSharp
    Replies:
    2
    Views:
    187
Loading...

Share This Page