dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersMore...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » ASP.NET »

OnClientClick event of Image button in repeater control


Posted Date: 20 Sep 2008      Posted By:: Yasotha     Member Level: Silver    Member Rank: 1413     Points: 1   Responses: 3



hi

i am using image button with in repeater control. i have to pass binding value to one javascript function from image button onclientclick event. my code as follows

<asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />

I am getting an error like

"The server tag is not well formed." for this
OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)"

thanks in advance




Responses

#297897    Author: D.Jeya kumar(JK)      Member Level: Gold      Member Rank: 12     Date: 20/Sep/2008   Rating: 2 out of 52 out of 5     Points: 5

Hi,


Are you using the image control in server side. ie in code behind with below function

ImgbtnSetPermission_Click if you have a function like this in code behind then remove the () in click event

OnClick="ImgbtnSetPermission_Click()"

OnClick="ImgbtnSetPermission_Click"


<asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />


Regards
JK

Thanks & Regards
D.Jeya Kumar(JK)



 
#297898    Author: Yasotha      Member Level: Silver      Member Rank: 1413     Date: 20/Sep/2008   Rating: 2 out of 52 out of 5     Points: 4

Hi

Thanks for ur reply.
I have removed and tested but again it shows the same error.
because of pssing binding value to javascript only am getting this error.
if i give static value like this then it is working well.
OnClientClick="javascript:return fnSetPermission('84')



 
#306233    Author: vinod      Member Level: Bronze      Member Rank: 0     Date: 13/Oct/2008   Rating: 2 out of 52 out of 5     Points: 6

Hi,

<asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />

You must remove double quotes around COL_ID, you may place single quotes...
<asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,'COL_ID')%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />

Check if this helps

Regards,

VINOD






 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : This tag should then have its "mode" attribute set to "Off".
Previous : what is bubble event?
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.