Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all
I am dynamicaaly create Controls in asp.net

When i am adding attributes to it for calling javascript like this
C#
lnkbutton1.Attributes.Add("OnClick", "javascript:showimage(" + i + ");")

but when i did
C#
lnkbutton1.Attributes.Add("OnClientClick", "javascript:showimage(" + i + ");")
then it is not firing query

Please help
Posted
Updated 8-Jan-12 19:43pm
v2
Comments
Al Moje 9-Jan-12 1:46am    
OnClientClick is used only in Client Page coding. In your case I think your code is in code behind. Categorically, on such case I think you must use your first above mention code...

1 solution

Hi

Try the following

LinkButton1.Attributes.Add("href", "javascript:javascript:showimage(" + i + ");");


Hope thi shelps
 
Share this answer
 

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