Solved

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

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

695 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