javascript - Passing value from Eval("Blah^^") to function in a js file via Onclick event of a href -


i'm beginner here code

<asp:repeater id="rpt_allsongthumbs" runat="server">    <itemtemplate>       <li>         <figure>           <a href='<%#databinder.eval(container.dataitem, "songname","index.aspx?songname={0}") %>'><%# eval("trackname")%></a>           <a href="#" runat="server" onclick="playsongnow()">              <span><img src="database/singlecovers/<%# eval("songart") %>" alt="cover"/></span>           </a>         </figure>       </li>   </itemtemplate> 

please me pass value of <&#eval(songname)%> function playsongnow(_something-i-don't-know-how-to-code-here_the-value-of-eval(trackname) in js file when 2nd href clicked on. able pass specific file name onclick="playsongnow('twerkitlikemiley-bb.mp3')" .i've been looking on itnet hours can't apply solutions problem myself, it's kinda hard me. thank you.

my html page:

        <div>         <asp:repeater id="rpt_allsongthumbs" runat="server">        <itemtemplate>           <li>             <figure>               <a href='<%#databinder.eval(container.dataitem, "songname","index.aspx?songname={0}") %>'><%# eval("trackname")%></a>               <a href="#"   onclick="playsongnow('<%# eval("productid").tostring() %>')">                  <span><img src="/images/<%# eval("songart") %>" alt="cover"/></span>               </a>             </figure>           </li>       </itemtemplate>          </asp:repeater>         </div> 

and code behind make work:

public class product {     public int productid { get; set; }     public string songname { get; set; }     public string trackname { get; set; }     public string songart {get; set; } } public partial class webform1 : system.web.ui.page {     protected void page_load(object sender, eventargs e)     {         var products = new list<product>();         products.add(new product() { productid = 1, songname = "help", trackname = "a track", songart = "bkg-blu.jpg" });         products.add(new product() { productid = 2, songname = "war", trackname = "b track", songart="pjstripe.jpg"});         products.add(new product() { productid = 3, songname = "sara", trackname = "c track",   songart="pjstripe2.jpg" });          rpt_allsongthumbs.datasource = products;         rpt_allsongthumbs.databind();     } } 

Comments