[英]Object not set to instance…blah
我有单选按钮,可以自动回传并将面板设置为可见或不可见。 整个页面位于更新面板中,因此我可以强制其更新并显示不可见的更改。 单选按钮也在更新面板中。
除了一件事,它工作正常-我的JavaScript不在窗口内! 更新面板后找不到我的任何控件。
有什么办法可以解决这个问题?
Panel PnlPersonInjury = (Panel)FormView1.FindControl("PnlPersonInjury");
Panel pnlPropertyDamage = (Panel)FormView1.FindControl("pnlPropertyDamage");
RadioButton CTypeP = (RadioButton)FormView1.FindControl("RadioButton1");
RadioButton CTypeC = (RadioButton)FormView1.FindControl("RadioButton2");
RadioButton LossLossP = (RadioButton)FormView1.FindControl("RadioButton3");
RadioButton LossLossI = (RadioButton)FormView1.FindControl("RadioButton4");
if (LossLossI.Checked)
{
// pnlPropertyDamage.Enabled = false;
PnlPersonInjury.Enabled = true;
PnlPersonInjury.Visible = true;
pnlPropertyDamage.Visible = false;
InjSummmary.Visible = false;
PropSummary.Visible = false;
}
else
{
pnlPropertyDamage.Enabled = true;
PnlPersonInjury.Enabled = false;
PnlPersonInjury.Visible = false;
pnlPropertyDamage.Visible = true;
InjSummmary.Visible = false;
PropSummary.Visible = false;
}
if (CTypeC.Checked)
{
cPanel.Enabled = true;
pPanel.Enabled = false;
cPanel.Visible = true;
pPanel.Visible = false;
}
else
{
cPanel.Enabled = false;
pPanel.Enabled = true;
cPanel.Visible = false;
pPanel.Visible = true;
}
UpdatePanel20.Update();
UpdatePanel2.Update();
我忽略了一些控件的实例化-因此这不是问题。
在没有看到JavaScript或不知道该代码的哪一部分与该错误相关的情况下,我猜想这行是您问题的一部分:
PnlPersonInjury.Visible = false;
如果服务器端控件是隐藏的,则不会向客户端标记呈现任何内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.