Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

Passing a parm to onClientClick

See code below.   The asp code works.  As does the VB.NET in the code behind.

What I want to do is in the asp code pass the PrimaryKey.Text as a parm, instead of where the 4 is.  Syntax-wise, I cannot get this to work.  

VB.NET CODE:

ShowButton1.Attributes.Add("onClick", "ShowRecord('" & PrimaryKey.Text & "');")


ASP.NET CODE

<asp:ImageButton runat="server" id="ShowButton1" causesvalidation="False" commandname="Redirect" cssclass="button_link" imageurl="../Images/icon_view.gif" tooltip="Show Funding Request"
onclientclick="return ShowRecord(4);">            
      </asp:ImageButton>
Avatar of Johny Bravo
Johny Bravo

It should be,

 ShowButton1.Attributes.Add("onclick", "javascript:return ShowRecord('"+PrimaryKey.Tect+"')");
Avatar of HLRosenberger

ASKER

I can get to it work in VB code.   What I cant get to work is the aspx code.  How do this change this, and replace the 4 with   'PrimaryKey.text' ?


<asp:ImageButton runat="server" id="ShowButton1" causesvalidation="False" commandname="Redirect" cssclass="button_link" imageurl="../Images/icon_view.gif" tooltip="Show Funding Request"
onclientclick="return ShowRecord(4);">            
      </asp:ImageButton>
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
CodeCruiser:

My PrimaryKey is a textbox control within a repeater control.  Will your suggestion with in this case?
thanks