Click here to Skip to main content
15,916,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my question is that i want to call play button event(item-command) on row click . which i was try by JavaScript . call JavaScript on tag on-click, but i don't call event

What I have tried:

<pre>   <asp:ListView ID="ListView1" runat="server" OnItemDataBound="ListView1_ItemDataBound" OnItemCommand="ListView1_ItemCommand">
                                        <ItemTemplate>
                                            <tr onclick="playfunction();" class="trclass" runat="server" id="trclass" style="cursor: pointer; width:100%;height:10%">
                                              
<td>......code...</td>
<td>
 <asp:LinkButton ToolTip="Play Recording" runat="server" ID="btnPlay" CommandArgument='<%# Eval("Filename")%>'  CommandName="Play" OnCommand="btnPlay_Command" />
</td>


the above is my listview .
my script is
  <script type="text/javascript">
             function playfunction() {
     
                 document.getElementById('btnPlay').click;
             <%--  //  document.getElementById('<%= btnPlay_Command.ClientID %>').click--%>

    }
</script>
Posted
Comments
F-ES Sitecore 30-May-18 6:06am    
If you have 10 rows you have 10 btnPlay buttons. How does your javascript playfunction know which btnPlay you want to click? javascript runs on the client, view the source of your page, do you see any elements with an id of "btnPlay" that your js can find? Also click is a method so it has to be ".click();"
prog.sidra 31-May-18 1:16am    
can u suggest me any solution . what should i do?
my task is to send CommandArgument='<%# Eval("Filename")%>' in itemcommand ,but on row double click

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900