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")
   {

   }
}

我的数据列表有一个按钮,创建后有 5 个图块,如下所示:

在此处输入图像描述

当我单击第一个按钮时,itemCommand 处的调试器被命中,但它没有命中其余 4 个图块,但页面确实回发。代码有问题吗?

4

0 回答 0