Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Ls is a link object

C#
LS.Attributes.Add("onclick", "myPopup5(1234)");

Above code is working but the below specified code not working ..
Not able to send a string as a paramenter
C#
LS.Attributes.Add("onclick", "myPopup5(ABCD)");
Posted
Comments
Zafar Sultan 6-Jun-13 8:29am    
Have you tried:
LS.Attributes.Add("onclick", "myPopup5('ABCD')");

??

Because ABCD is a string and since you did not put it in quotes the parser assumes it is an object, which it is not.

Try
C#
LS.Attributes.Add("onclick", "myPopup5('ABCD')");
 
Share this answer
 
Below is not working because the JavaScript is not able to recognize ABCD as an object (considering you are passing a simple string here).

Change it to LS.Attributes.Add("onclick", "myPopup5('ABCD')"); [note the single quote] and it should work fine.
 
Share this answer
 
v2
Comments
Jithin Geroge 6-Jun-13 8:36am    
Thanks... I got it working...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900