日期:2014-05-20  浏览次数:20521 次

重载均与委托“System.EventHandler”不匹配?
我想点击LinkButton1和LinkButton2后都执行DataList1_ItemCommand

错误提示:“DataList1_ItemCommand”的重载均与委托“System.EventHandler”不匹配
<asp:LinkButton   ID= "LinkButton4 "     CommandName= "category "   runat= "server "   text= "类别信息 "   OnClick= "DataList1_ItemCommand "   /> <br> //这一行是红色
行   30:                                
<asp:LinkButton   ID= "LinkButton5 "     CommandName= "supplier "   runat= "server "   text= "供应商 "   OnClick= "DataList1_ItemCommand "/>
行   31:                                                                           </td>


.aspx部分代码

<asp:DataList   ID= "DataList1 "   runat= "server "     Width= "275px "   OnSelectedIndexChanged= "DataList1_SelectedIndexChanged "   DataKeyField= "pro_id ">
              <ItemTemplate>                        
<table   style= "width:   174px ">
  <tr>
      <td   style= "width:   70px "> <asp:Image   ID= "Image3 "   runat= "server "   Width= "100px "   Height= "100px "   ImageUrl= ' <%#   Eval( "photo ", "pic_{0}.bmp ")   %> '> </asp:Image>

    </td>
    <td   style= "width:   1987px "> 产品: <br>
                                                      单价: <br>
                                                      单位: <br>
<asp:LinkButton   ID= "LinkButton4 "     CommandName= "category "   runat= "server "   text= "类别信息 "   OnClick= "DataList1_ItemCommand "   /> <br>
<asp:LinkButton   ID= "LinkButton5 "     CommandName= "supplier "   runat= "server "   text= "供应商 "   OnClick= "DataList1_ItemCommand "/>
      </td>
      <td>
<asp:LinkButton   ID= "LinkButton6 "     CommandName= "select "   runat= "server "   text= ' <%#   Eval( "pro_name ")   %> '/> <br>
        <%#   Eval( "price ")   %> <br>
        <%#   Eval( "unit ")   %>
      </td>
  </tr>

</table>
</ItemTemplate>
</asp:DataList>
.cs部分代码
  protected   void   DataList1_ItemCommand(object   sender,   DataListCommandEventArgs   e)
        {
                string   commstr1   =   "select   a.pro_id,b.provider_string,c.class_string   from   产品表   as   a,供应资料   as   b,产品类别   as   c   where   pro_id= ' "   +