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

本文关键字:第一个 参数 扩展 方法 包含 定义 包含接 | 更新日期: 2023-09-27 18:29:31

我在的下面一行代码中得到了这个错误

"不包含"RadioButtonList1_SelectedIndexChanged1'"的定义,并且找不到接受类型为"ASP.addreservation.aspx"的第一个参数的扩展方法"RadioButton List1_SelectedIndex Changed1'"(是否缺少using指令或程序集引用?)"

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

我不知道为什么会发生这种情况,因为我已经在后面的代码中选择了索引更改方法

 protected void RadioButtonList1_SelectedIndexChanged1(object sender, EventArgs e)
    }

有人知道这是什么问题吗?我试着清理项目并重建,但没有成功。

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

可能是您错过了事件的左括号,这就是的原因

 protected void RadioButtonList1_SelectedIndexChanged1(object sender, EventArgs e)
{
}

private Image fillImage;private Text textLabel;

private float value = 0f;
private bool isDone = false;
void Awake() 
{
    this.fillImage = this.transform.Find("Fill").GetComponent<Image>();
    this.textLabel = this.transform.Find("Text").GetComponent<Text>();
    
    
}
// Start is called before the first frame update
void Start()
{
    this.fillImage.fillAmount = 0f;
    
}
// Update is called once per frame
void Update()
{
    if (this.isDone)
    {
        if(this.OnDoneEvent != null)
            this.OnDoneEvent ();
        this.OnDoneEvent = null;
        this.OnchangeEvent = null;
        return;
    }
    if(this.OnchangeEvent != null)
       this.OnchangeEvent((int)(this.value *100));
    this.fillImage.fillAmount = this.value;
    this.textLabel.text = (this.value >= 1) ? "Done!" : (this.value * 100) + "%";
    this.isDone = (this.value >= 1)? true : false;
    
}
#region Get and set
public void setValue(float value )
{
    this.value = value;
}
public float GetValue()
{
    return this.value;
}
#endregion
#region Events
public void onChange(valueChanged method)
{
    this.OnChangeEvent += method;
}
public void onDone(ProgressDone method)
{
    this.OnDoneEvent += method;
}
public delegate void valueChanged(float value);
private event valueChanged OnchangeEvent;
public delegate void ProgressDone();
private event ProgressDone OnDoneEvent;
#endregion
相关文章: