asp.net - Pass GridView column value to Javascript function - OnClientClick -


i have grid view this:

<asp:sqldatasource id="sqlpersistentoffenders" runat="server"></asp:sqldatasource>     <asp:gridview id="gvpersistentoffenders" runat="server" datasourceid="sqlpersistentoffenders" allowpaging="true" autogeneratecolumns="false">     <columns>         <asp:templatefield headertext="personid" visible="false">             <itemtemplate>                  <asp:label id="labcreuser" runat="server" text='<%# bind("creuser")%>'></asp:label>                                    </itemtemplate>         </asp:templatefield>          <asp:templatefield>             <itemtemplate>                 <asp:button id="buttonsendemail" runat="server" commandname="sendemail" commandargument="<%# ctype(container,gridviewrow).rowindex %>" text="send email" onclientclick="getemailaddress()"/>                                  </itemtemplate>         </asp:templatefield>     </columns> </asp:gridview> 

the javascript looks this:

<script type="text/javascript">         function getemailaddress(creuser) {            //do } </script> 

how can pass value in labcreuser row selected javasript function?

i have looked here: passing variables javascript in onclientclick , few other questions. nothing have tried has worked.

you can pass parameter js function way

onclientclick=<%# "getemailaddress('" + eval("creuser") + "')" %> 

this became in

onclientclick="getemailaddress('yourvalue')" 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -