Solved

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

Posted on 2013-01-15
2
560 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can Selenium do Load Testing? 2 56
Angular2 remove duplicates 11 19
Data Analysis 7 57
Make icons act like add/minus for qtys 6 37
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.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

738 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