不包含接受第一个参数的定义,也没有扩展方法

时间:2016-01-09 02:36:31

标签: c# asp.net radiobuttonlist selectedindexchanged

我在以下代码行中出现此错误

  

“不包含'RadioButtonList1_SelectedIndexChanged1'的定义,并且没有扩展方法'RadioButtonList1_SelectedIndexChanged1'接受类型为'ASP.addreservation_aspx'的第一个参数'(您是否缺少using指令或汇编引用?)”

 <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" 
    OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged1" 
    RepeatDirection="Horizontal">

我不知道为什么会发生这种情况,因为我已经在

后面的代码中使用了selectedindexchanged方法
 protected void RadioButtonList1_SelectedIndexChanged1(object sender, EventArgs e)

    }

所以任何人都知道这是什么问题?我尝试清理项目并重建,但它不起作用。

1 个答案:

答案 0 :(得分:1)

可能你错过了事件的开场支架

@Command
@NotifyChange("timer")
public void longOperation() {
    timer = true;
    Thread r = new Thread(new Runnable() {

        @Override
        public void run() {

            log = "button pressed, initializing now";
            sleep(5000); // this is a private method for calling Thread.sleep
            log = "initialized done, processing now";
            sleep(5000);
            log = "finished";
            timer = false;
        }
    });
    r.start();
}

@Command
@NotifyChange({"log","timer"})
public void refreshTextbox(){
  if (!timer) {
      Clients.showNotification("timer stopped"); 
  }
}