OnClientClick pass parameter from databinding

R

Randy

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top