Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 当asp验证程序用于页面时,服务器端事件不会第一次触发_Asp.net - Fatal编程技术网

Asp.net 当asp验证程序用于页面时,服务器端事件不会第一次触发

Asp.net 当asp验证程序用于页面时,服务器端事件不会第一次触发,asp.net,Asp.net,我创建了一个带有更新面板的页面,并使用Asp.net验证控件 验证页面是否存在问题是我将直接提交页面 页面得到正确验证之后,我将单击/选择页面上的任何控件 该页面无法返回 下面是我使用的代码 <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <div id="divMyDataManualEntry" runat="server"> <table cellpaddin

我创建了一个带有更新面板的页面,并使用Asp.net验证控件 验证页面是否存在问题是我将直接提交页面 页面得到正确验证之后,我将单击/选择页面上的任何控件 该页面无法返回

下面是我使用的代码

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<div id="divMyDataManualEntry" runat="server">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<td style="width: 5%;" valign="top">
<asp:Label ID="lblGeo" Font-Bold="true" runat="server" Text="Geography"></asp:Label><span
class="redtext">*</span>
</td>
<td valign="top" style="width: 15%">
<asp:DropDownList ID="ddlgeo" TabIndex="1" runat="server" CssClass="textbox" Width="100%"
OnSelectedIndexChanged="ddlgeo_SelectedIndexChanged"  AutoPostBack="true"> 
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlgeo"
ValidationGroup="Submit" InitialValue="-1" ErrorMessage="Select Geography"></asp:RequiredFieldValidator>
</td>                     
</tr> </table>
<table width="100%" id="BtnContainer" runat="server">
<tr>
<td align="center">
<asp:Button ID="btnSubmit" runat="server" OnClientClick="javascript:return IsValidated();"
ValidationGroup="Submit" CssClass="Keybutton" TabIndex="14" Text="Submit" OnClick="btnSubmit_Click" />
<asp:Button ID="btnreset" runat="server" Text="Reset" CssClass="Keybutton" TabIndex="15"
OnClick="btnReset_click" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

Add CausesValidation=false对于除了submit按钮之外生成回发的所有控件我已经尝试过了我从未得到任何问题的解决方案如果显示代码会更容易,您尝试了什么,但什么不起作用我只使用服务器端控件fire服务器端事件,但验证控件可以进行验证,因此如果我使用按钮提交表单,则仅与验证组链接,而不是其他控件,并且其他控件具有“CauseValidation=false”。