Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ...I am calling a javascript function in href attribute which is placed under repeater control as shown below


<a id="a1" runat="server" title="View Use" href='javascript:ShowUseSummary("<%# DataBinder.Eval(Container.DataItem, "ID") %>");'>asp.net

The output of anchor tag is displaying the value like below when page is executed.

");" id="AuxiliaryInfoRepeater_ctl01_a1" title="View Use">asp.net

please help me what is the problem in parsing
Posted
Updated 2-Dec-14 0:00am
v3
Comments
Kornfeld Eliyahu Peter 2-Dec-14 4:56am    
What is this: java<!-- no -->script?
frend_rose 2-Dec-14 5:58am    
sorry I think it is replaced wrongly....it is javascript not java<!-- no -->script?
Kornfeld Eliyahu Peter 2-Dec-14 6:02am    
Do you care to update your question with proper details and format?
frend_rose 3-Dec-14 3:27am    
I will take care.Please give the answer for my question.
Praveen Kumar Upadhyay 2-Dec-14 5:04am    
it is javascript: I guess

Try this
<a id="a1" runat="server" title="View Use" href=javascript:ShowUseSummary("<%# DataBinder.Eval(Container.DataItem, "ID") %>")></a>
 
Share this answer
 
Comments
frend_rose 2-Dec-14 6:01am    
It is giving unexpected token error at the outer double quote
Praveen Kumar Upadhyay 2-Dec-14 7:59am    
Put ID is single quote
frend_rose 3-Dec-14 3:17am    
when I put ID in single quote ,it si giving error as "Bad compile constant value"
change the href attribute like this
]]> .

Then it will work
 
Share this answer
 
if it is inside the repeater then



href='javascript:ShowUseSummary(<%#Eval("ID")%>);'>


js

function ShowUseSummary(id){

//...
return url;
}
 
Share this answer
 
Comments
frend_rose 3-Dec-14 3:26am    
It is showing the data like as below
);" id="AuxiliaryInfoRepeater_ctl01_auxiliaryInfoHyperLink" title="View Use"> .

It is not binding the data for ex data is test1 then it is not displayed in the UI.

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