我的 aspx 页面中有复选框,后面的代码中有 oncheckedchanged 事件处理程序。我的aspx页面如下
<div align="center">
<table width="500px">
<tr>
<td>
<fieldset id="fs1" runat="server">
<legend>Type </legend>
<table>
<tr>
<td>
<asp:CheckBox ID="CBNPatient" runat="server" Text="New Patient" OnCheckedChanged="CBNPatient_CheckedChanged" AutoPostBack="true" />
</td>
<td>
<asp:CheckBox ID="CBNPhPatient" runat="server" Text="New Patient By Phone" OnCheckedChanged="CBNPhPatient_CheckedChanged" AutoPostBack="true" />
</td>
</tr>
<tr>
<td colspan="2">
<fieldset id="fsAdd" runat="server" visible="false">
<table>
在后面的代码中,复选框事件处理程序如下:
protected void CBNPatient_CheckedChanged(object sender,EventArgs e )
{
if (CBNPatient.Checked == true)
{
HtmlGenericControl fieldset = (HtmlGenericControl)Master.FindControl("fsAdd");
fieldset.Visible = true;
PatAdd = true;
}
else
{
HtmlGenericControl fieldset = (HtmlGenericControl)Master.FindControl("fsAdd");
fieldset.Visible = false;
PatAdd = false;
}
}
protected void CBNPhPatient_CheckedChanged(object sender, EventArgs e)
{
if (CBNPhPatient.Checked == true)
{
HtmlGenericControl fieldset = (HtmlGenericControl)Master.FindControl("fsAdd");
fieldset.Visible = true;
PhPatAdd = true;
}
else
{
HtmlGenericControl fieldset = (HtmlGenericControl)Master.FindControl("fsAdd");
fieldset.Visible = false;
PhPatAdd = false;
}
}
我收到如下编译错误:
'ASP.framepages_registration_raddock_aspx' 不包含'CBNPatient_CheckedChanged' 的定义,并且找不到接受'ASP.framepages_registration_raddock_aspx' 类型的第一个参数的扩展方法'CNPatient_CheckedChanged'(您是否缺少 using 指令或程序集引用?)复选框位于字段集中。这会导致任何问题吗?
请帮助我。谢谢, 苏米亚