已检查的更改事件未触发

时间:2017-06-07 04:32:18

标签: c# asp.net

我想在已检查的更改事件上启用和禁用文本字段,但此事件未触发。 以下是我的单选按钮代码

<asp:RadioButton ID="submitter" runat="server" GroupName="rd2" OnCheckedChanged="submitter_CheckedChanged" Text="Submitter" />
                        &nbsp;&nbsp;
        <asp:RadioButton ID="following" runat="server" ForeColor="Black" Text="Following" GroupName="rd2" OnCheckedChanged="following_CheckedChanged" />

以下是我检查的更改事件代码

protected void following_CheckedChanged(object sender, EventArgs e)
    {
        if (submitter.Checked == true)
        {
            contactName.Enabled = false;
            Contactmail.Enabled = false;
            Response.Write("<script LANGUAGE='JavaScript' >alert('following event submitter check')</script>");
        }
       if (following.Checked == true)
        {
            contactName.Enabled = true;
            Contactmail.Enabled = true;
            Response.Write("<script LANGUAGE='JavaScript' >alert('following event following check')</script>");
        }
    }

    protected void submitter_CheckedChanged(object sender, EventArgs e)
    {
        if (submitter.Checked == true)
        {
            contactName.Enabled = false;
            Contactmail.Enabled = false;
            Response.Write("<script LANGUAGE='JavaScript' >alert('submitter event submitter check')</script>");
        }
        if (following.Checked == true)
        {
            contactName.Enabled = true;
            Contactmail.Enabled = true;
            Response.Write("<script LANGUAGE='JavaScript' >alert('submitter event following check')</script>");
        }

请告诉我哪里有问题。感谢

2 个答案:

答案 0 :(得分:2)

设置<ul> <li v-for="food in foods"> <h2>{{food.name}}</h2> <ul> <li v-for="nutrient in food.nutrients">{{nutrient.nutrient_id}}</li> </ul> </li> </ul> axios.get(url).then(response => { this.foods = response.data.report.foods })

回发意味着将数据发送到服务器。它将执行服务器端事件。 更多详情Click Here

AutoPostBack="true"

答案 1 :(得分:2)

您需要添加public partial class Employee { public int Emp_Id { get; set; } [Column("Emp_Name")] public string EmpName { get; set; } public string Emp_City { get; set; } public Nullable<int> Emp_Age { get; set; } }

将aspx代码更改为:

AutoPostBack="true"
相关问题