简体   繁体   English

回传表单隐藏DIV

[英]Postback of Form hiding DIV

I have a contest form that is a usercontrol, it sits on page that has several usercontrols on it. 我有一个竞赛表单,它是一个用户控件,它位于页面上,上面有几个用户控件。 When a user clicks a button it displays this form which resides in usercontrol, the div (which is on the page) is hidden at first. 当用户单击一个按钮时,它将显示驻留在usercontrol中的此表单,该div(位于页面上)首先被隐藏。 The only problem I am running into is when the page post backs it hides the DIV even when there is an error. 我遇到的唯一问题是,即使有错误,页面帖子返回时它也会隐藏DIV。 I need it to keep the DIV open if there is an error, the code logic for form validation is in the usercontrol so how could I access the DIV that is on the page? 如果有错误,我需要它使DIV保持打开状态,用于表单验证的代码逻辑在usercontrol中,因此如何访问页面上的DIV? The page is a masterpage, we dont do any code logic in our masterpages, is there anyway to accomplish this without code on the masterpage? 该页面是一个母版页,我们在母版页中不执行任何代码逻辑,是否在母版页上没有代码的情况下完成此操作?

最好的方法是公开一些属性,该属性指示用户控件上是否发生任何错误,然后根据该用户控件属性在页面本身上设置Div的可见性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM