【发布时间】:2012-08-21 13:27:28
【问题描述】:
我的 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”类型的第一个参数的扩展方法“CBNPatient_CheckedChanged”(您是否缺少 using 指令或程序集引用? ) 复选框位于字段集中。这会导致任何问题吗?
请帮助我。 谢谢, 苏米亚
【问题讨论】:
-
你好 Soumya 你在 System.Web 上添加了参考
-
@Soumya,你能发布你的页面指令部分吗?
-
您最近添加了这些处理程序吗?您的标记可能已更改,但由于某种原因未重建代码隐藏。重建(必要时重新部署)整个项目。
-
我的参考中有 System.web...
-
请找到我的页面指令 在我使用命名空间 UnicareSystemWeb.FramePages.Registration { public partial class raddock : System.Web.UI.Page { 背后的代码
标签: c# asp.net-ajax