我有一个用户控件,其结构是 -
<updatepanel UpdateMode="Always">
<ContentTemplate>
<asp:FormView>
<EditItemTemplate>
<table>
<tr id='tr1'>
<td>
Textbox1
btn1
</td>
</tr>
<tr id='tr2'>
<td>
textbox2
</td>
</tr>
<table>
</EditItemTemplate>
</asp:FormView>
</ContentTemplate>
</updatepanel>
在页面加载时,我使用以下来隐藏 tr2
ClientScriptManager cs = Page.ClientScript;
csText.AppendLine("");
csText.AppendLine("if(document.getElementById('tr2')!=null)
document.getElementById('tr2').style.display = 'none';");
csText.AppendLine("");
cs.RegisterStartupScript(this, this.GetType(), csName, csText.ToString(), false);
这部分工作正常。现在点击 btn1 我弹出模态弹出扩展控件。这会导致 tr2 再次显示。我知道脚本需要与 updatePanel 内联。我尝试使用ScriptManager.RegisterStartupScript(....);
但不起作用。此外 updateMode 需要始终如此,以便可以将来自 pop 扩展器的数据放入 Textbox1
感谢所有帮助。谢谢