0
<asp:DataList ID="lstMachineTools" runat="server" Width="100%" OnItemCommand="lstMachineTools_ItemCommand">
    <ItemStyle ForeColor="Black" BorderWidth="1px"  CssClass="list-group-item" />
    <ItemTemplate>
        <div class="panel-body" >
            <form class="form-horizontal" role="form">
                <div class="form-group">
                    <label class="col-lg-10 col-md-10 col-sm-10  pull-left">
                        <%# Eval("description")%>
                    </label>
                    <div class="col-lg-2 col-md-2 col-sm-2 pull-right">
                        <asp:Button CommandName="isClicked" CommandArgument='<%# Eval("idPlcDataSeq")%>' runat="server" class="form-control " type="button" style="width: 20px; height: 20px"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-9 col-md-9 col-sm-9 bottom text-left">
                        <%#((DateTime)Eval("dataRecMoment")).ToString("dd-MMM-yyyy hh:mm:ss tt")%>
                    </label>
                    <asp:Label runat="server"   Font-Bold="true"    class="col-lg-3 col-md-3 col-sm-3 bottom  text-right pull-right" ForeColor='<%# System.Drawing.Color.FromName(Eval("color").ToString())%>'><%# Eval("value")%>
                    </asp:Label>
                </div>
            </form>
        </div>
    </ItemTemplate>
</asp:DataList>

protected void lstMachineTools_ItemCommand(object source, DataListCommandEventArgs e)
{
   if (e.CommandName == "isClicked")
   {

   }
}

My datalist is has a button, and when created, has 5 tiles this is how it looks like:

enter image description here

When I click the first button, the debugger at itemCommand is hit, but it does not hit for the rest of the 4 tiles, however the page does post back. Is there an issue with the code.?

  • what you want to do? –  Jul 25 '17 at 18:09
  • I want to perform a button click of each and every item of the list, when clicked, gives me the tile item data context, according to which I can perform actions. But only the button of the first tile is getting hit, not the rest of the tiles – Gurprasad Singh Jul 27 '17 at 03:10

0 Answers0