Solved

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

Posted on 2013-01-15
2
554 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

770 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