Solved

Pass ItemTemplate field value as a paramter to Javascript function ASP.NET

Posted on 2013-01-15
2
547 Views
Last Modified: 2013-01-15
How can I pass a value for link button onClientclick, which call a JS function which accepts two values like this:
 <ItemTemplate>
 <asp:LinkButton ID="lnkEdit" runat="server" Text="Change" Font-Underline="false"
   OnClientClick="return edit('EDIT',  "<%= Eval( "ID"));" ForeColor="Blue" />'
   </ItemTemplate>
<ItemTemplate>
 <asp:Label ID="lblID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID")%>'Style="display: none" />
 </ItemTemplate>

Open in new window

I was getting error Server Tag not well formed, and also is it the way to pass the template field value or I need to do document.getelementbyid.
0
Comment
Question by:ASPDEV
2 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 38780370
try this:
 OnClientClick='<%# Eval("ID", "return edit(\"EDIT\",{0});") %>' 

Open in new window

0
 

Author Closing Comment

by:ASPDEV
ID: 38780496
Thanks.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now