asp.net - datalist eval passed to javascript not workig -


i passing eval value datalist javascript function not passed. "first_name" not passed when passed "job_id" parameter display value. how can pass "first_name". below code:

<%@ page language="c#" autoeventwireup="true" codefile="test.aspx.cs" inherits="test" %>    <html xmlns="http://www.w3.org/1999/xhtml">  <head runat="server">      <title>jquery ui autocomplete - multiple values</title>            <script type="text/javascript">          function showmodalpopup(name) {              alert(name);              return false;                   }             </script>  </head>  <body style="margin: 0px 0px 0px 0px;">      <form id="form1" runat="server">           <div style="width: 100%;">          <asp:datalist id="dljobs" runat="server" repeatdirection="horizontal" repeatcolumns="1"              datakeyfield="job_id" cellpadding="10" itemstyle-verticalalign="top" width="100%"              onitemcommand="dljobs_itemcommand">              <itemtemplate>                  <div style="font-size: small; float: right; margin-left: 20px;">                      <asp:linkbutton id="lnkcontactreferrer" text="contact referrer" runat="server" commandargument='<%# eval("job_id") %>'                          commandname="contactreferrer" style="background: #4e9caf; padding: 5px 10px 5px 10px;                          text-align: center; border-radius: 5px; color: white; font-weight: bold; text-decoration: none;                          margin-left: 5px; margin-right: 5px;" onclick='<%# "return showmodalpopup(" +eval("first_name") + " );" %>'></asp:linkbutton>                  </div>              </itemtemplate>          </asp:datalist>      </div>      </form>  </body>  </html>

please advice

name string value. must add double quote call showmodalpopup method following.

showmodalpopup("jon") 

double quote missing in code.

onclick='<%# "return showmodalpopup(\"" + eval("first_name") + "\");" %>' 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -