0

我的第一个更新面板包括-

                        <!--begin twelvecol -->
                        <asp:ScriptManager ID="scrAdmission" runat="server"></asp:ScriptManager>
                        <asp:UpdatePanel ID="updateAdmission" runat="server" UpdateMode="Conditional">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnApply" EventName="Click" />
                        </Triggers>
                        <ContentTemplate>

                        <div class="twelvecol" style="text-align:center">
    <asp:DropDownList ID="ddwnCourse" runat="server" style="width:220px;margin-left:-15px;font-family: Arial, Helvetica, sans-serif; font-size:11px;padding:2px;font-weight:bold;border:#fff solid 1px;  color:#5c5c5c" onchange="CourseCode();setTimeout(&#39;__doPostBack(\&#39;drpcourse\&#39;,\&#39;\&#39;)&#39;, 0)">
        <asp:ListItem>Select Course</asp:ListItem>
        <asp:ListItem>MBA</asp:ListItem>
        <asp:ListItem>BBA</asp:ListItem>
        <asp:ListItem>BCA</asp:ListItem>
        <asp:ListItem>EMBA</asp:ListItem>
        <asp:ListItem>B.Com</asp:ListItem>
        <asp:ListItem>MCA</asp:ListItem>
        <asp:ListItem>PGPM</asp:ListItem>
        <asp:ListItem>BBM</asp:ListItem>
        <asp:ListItem>PGDM(1 Year)</asp:ListItem>
        <asp:ListItem>PGDM(2 Year)</asp:ListItem>
    </asp:DropDownList>
    <div class="twelvecol" style="margin-top:15px;">
         <input class="left-input" type="text" id="txtName" runat="server" required="" name="First Name" placeholder="First Name*" />
    </div>
    <div class="twelvecol">
         <input class="left-input" type="text" id="txtEmail" runat="server" required="" name="Email Id" placeholder="Email Id*" />
    </div>
    <div class="twelvecol">
          <input class="right-input" type="text" id="txtMobile" runat="server" required="" name="Mobile No" placeholder="Mobile No.*" />
     </div>
    <div class="twelvecol">
          <input class="right-input" type="text" id="txtState" runat="server" required="" name="State" placeholder="State*" />
    </div>
    <div class="twelvecol">
         <input class="right-input" type="text" id="txtCity" runat="server" required="" name="City" placeholder="City*" />
    </div>
    <div class="twelvecol">
         <input class="right-input" type="text" id="txtLocation" runat="server" required="" name="Location" placeholder="Location*" />
    </div><br /><br />
    <input id="cbcheck" runat="server" type="checkbox" name="cbcheck" checked="checked" />&nbsp I Agree to the terms of services and privacy policy* <br /><br />
     <asp:Label runat="server" ID="lblError" Visible="false" ForeColor="#FF5050"></asp:Label>
     <asp:Button CssClass="button_yellow scroll_btn small_btn" Text="Apply Now" runat="server" ID="btnApply" onclick="btnApply_Click" />
</div>
                        </ContentTemplate>
                        </asp:UpdatePanel>                               

我的第二个 UpdatePanel 包括

<asp:UpdatePanel ID="updateOrder" runat="server" UpdateMode="Conditional">
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="btnOrder" EventName="Click" />
                            </Triggers>
                            <ContentTemplate>
                            <div class="sixcol">
                            <form id="contact-form" name="" action="#" method="post">
                            <div class="twelvecol">
                                    <input class="left-input" type="text" name="First Name" placeholder="First Name*" />
                                    <div class="twelvecol">
                                    <input class="right-input" type="text" name="Last Name" placeholder="Last Name*" />
                                    </div>
                            </div>
                            <div class="twelvecol">
                                    <input class="left-input" type="email" required="" name="Email" placeholder="Email*" />
                                    <input class="right-input" type="text" name="Phone No." placeholder="Phone No.*" />
                            </div>
                            <div class="twelvecol">
                                <input class="full-input" type="text" name="Subject" placeholder="Subject*" />
                            </div>
                            <div class="twelvecol">
                                <textarea name="Message" placeholder="Message..." rows="2" cols="20" class="contact-commnent"></textarea>
                            </div>
                            <asp:Button ID="btnOrder" runat="server" CssClass="contact-submit button_yellow" Text="Send E-Mail" />
                        </form>                                 
                            </div>
                            </ContentTemplate>
                            </asp:UpdatePanel>

现在的问题是,许多字段在两种表单中都有自定义所需的验证。当我尝试单击任何 asp 按钮提交我的字段时,其他表单验证会产生冲突,我如何在同一页面中使用两个不同的更新面板,但两个面板的行为应该不同。

4

1 回答 1

1

ASP.NET 中可能只有一个表单标记。要拥有不同表单的外观,您可以使用 ValidationGroup 属性为每个控件创建独立的部分。

从第二个更新面板中删除表单元素。添加将 ValidationGroup 属性设置为诸如contactform 之类的内容。您不必将validationgroup 设置为顶部表单,因为空字符串计为一个组。

于 2013-08-25T15:01:29.720 回答