我用的vs2008,不知道为什么itemcommand 事件不触发。
   代码如下:
           if (!IsPostBack)
            {
                 BindOperation();
            }             private void BindOperation()
            {
;
            DataSet data = XXXX
            this.OList.DataSource = data.Tables[0];
            this.OList.DataBind();            }
            protected void OList_ItemCommand1(object source, RepeaterCommandEventArgs e)
             {
            switch (e.CommandName)
            {
                case "EditItem":
                   aa;
                    break;
       
            }
        }  这段不执行,着急请教

解决方案 »

  1.   

    方法叫OList_ItemCommand1
    你看你 .aspx绑定的是这个名么?
      

  2.   

     <asp:Repeater ID="OList" runat="server" onitemcommand="OList_ItemCommand1"这个没问题。
      

  3.   

     <asp:Repeater ID="OList" runat="server" onitemcommand="OList_ItemCommand1" onitemdatabound="OList_ItemDataBound">
                <HeaderTemplate>
                     <tr>
                          <th style="width:5%;border-left:#ccc 1px solid;">序号</th>
                          <th style="width:2%"><asp:CheckBox ID="chkCh" runat="server" onclick="selectall2()"/></th>
                          <th style="width:12%">业务单号</th>
                          <th style="width:20%">房屋坐落</th>
                          <th style="width:11%">所有权人</th>
                          <th style="width:10%">业务类别</th>
                          <th style="width:10%">受理日期</th>
                          <th style="width:7%">受理人</th>
                          <th style="width:28%;border-right:1px solid #ccc;">业务操作</th>
                     </tr>
                   </HeaderTemplate>    这是前台的代码
      

  4.   

    楼主看看你的,<ItemTemplate>里有没有写CommandName=""