Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
img.ID = "img" + i;
                   string id = img.ID;
                   img.ImageUrl = ("../Images/Cross.jpg");
                   img.Attributes.Add("onClick", "show("id");");


giving me error

how to pass id to my js function show
Posted
Comments
Patrice T 11-Aug-15 1:48am    
Which error ? Where ?

I don't know ASP, but
"show("id");"
is certainly not good.
Search how to embed quotes (") in a string.
 
Share this answer
 
Comments
saikartik 11-Aug-15 2:47am    
img.ID = "img" + i;
string id = img.ID;
img.ImageUrl = ("../Images/Cross.jpg");
img.Attributes.Add("onClick", "show("+id+");");


this what i need
C#
img.ID = "img" + i;
string id = img.ID;
img.ImageUrl = ("../Images/Cross.jpg");
img.Attributes.Add("onClick", "show("+id+");");



need to place id in between '++'..

missed with syntax.
 
Share this answer
 
Comments
Patrice T 11-Aug-15 3:00am    
You don't have to use solution to your own question !
You have to use 'Improve Question' instead, and do corrections.
Patrice T 11-Aug-15 3:01am    
Your changes certainly lead to an other error at runtime.
saikartik 11-Aug-15 5:05am    
please let me know the error... wchic occurs runtime

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