我有单选按钮,可自动回行并将面板设置为可见或不可见。整个页面位于更新面板中,以便我可以强制它更新并显示不可见的更改。单选按钮也在更新面板中。
除了一件事之外它工作正常 - 我的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();
我离开了一些控件的实例化 - 所以这不是问题。
答案 0 :(得分:3)
如果没有看到JavaScript,或者知道此代码的哪一部分与错误有关,我猜这一行是您问题的一部分:
PnlPersonInjury.Visible = false;
如果隐藏了服务器端控件,则它不会向客户端标记呈现任何内容。