Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6245181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:27:36+00:00 2026-05-24T12:27:36+00:00

I’m using the AjaxControlToolkit, which I haven’t used in a while so I know

  • 0

I’m using the AjaxControlToolkit, which I haven’t used in a while so I know I’m a bit rusty. I created a simple form in an asp:Panel with one field and a required field validator. I would like to keep the form from closing if the form is not valid. I can’t seem to figure out how to accomplish this seemingly simple task. Code is provided from where I am right now. Does anyone know of a solution on how to accomplish this?

<%@ Control Language="C#" 
            AutoEventWireup="true" 
            CodeBehind="Supplier_VAN_Config.ascx.cs"
            Inherits="PPGEDI.App_Controls.Supplier.Supplier_VAN_Config" %>


<asp:DropDownList ID="ddlVanGroups" 
                  runat="server" 
                  AutoPostBack="true"
                  OnSelectedIndexChanged="ddlVanGroups_selectedIndexChanged" /> 
<asp:LinkButton ID="addVanGroup" runat="server" Text="Add New VAN Group" />



<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server"
    TargetControlID="addVanGroup"
    PopupControlID="pnlAddVanGroup"
    BackgroundCssClass="modalBackground" 
    DropShadow="true" 
    OkControlID="addVanGroupOK" 
    CancelControlID="addVanGroupCancel" 
    PopupDragHandleControlID="pnlAddVanGroupHeader" />

<asp:Panel ID="pnlAddVanGroup" 
           runat="server" 
           style="display: none;" 
           CssClass="modalPopup" >
   <asp:Panel ID="pnlAddVanGroupHeader" 
           runat="server" 
           CssClass="modalHeader">
      Add New Van Group
   </asp:Panel>

   <div class="formInfo">
      <span class="formLabel">Group Name: 
         <asp:TextBox CssClass="formInput" 
                      ValidationGroup="AddNewVanPopup" 
                      ID="txtNewVanGroupName" 
                      runat="server" />
      </span>
      <asp:RequiredFieldValidator ID="rfvGroupName" 
                                  runat="server" 
                                  ValidationGroup="AddNewVanPopup"
                                  ControlToValidate="txtNewVanGroupName"
                                  Display="Static" 
                                  ErrorMessage="Group Name is required" 
                                  Text="Group Name is required" />

   </div>


   <asp:LinkButton ID="addVanGroupOK" 
                   Text="ADD" 
                   ValidationGroup="AddNewVanPopup"  
                   runat="server" />
   <asp:LinkButton ID="addVanGroupCancel" 
                   runat="server" 
                   Text="Cancel" />
</asp:Panel>

When I click the ADD button, when the text box is empty, it gives the error message and closes the box. When I click on the link again, the form comes back up, and the error message is still there. Do I need to handle this in javascript?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:27:37+00:00Added an answer on May 24, 2026 at 12:27 pm

    The problem with the code you submitted is that it use a OkControlID="addVanGroupOK". It close the popup and it absorb the server-side event for clicking on it. You could handles thing with the OnOkScript, but you will have to manually raise the addVanGroupOK_Click server-side event (and I suppose you need this event to raise).

    I suggest Manually close the pop-up upon validation using javascript

    here some script :

    function HideMPEPopup() {
         $find(MPE).hide();
    
    }
    function ValidateAndHideMPEPopup() {
        //  hide the Popup 
        if (Page_ClientValidate('AddNewVanPopup')) {
            HideMPEPopup();
        }
    }
    

    Then just plug this script to the addVanGroupOK button and dont forget to remove the OkControlID from the ModalPopupExtender.

    <asp:LinkButton ID="addVanGroupOK" 
                   Text="ADD" 
                   ValidationGroup="AddNewVanPopup"
                   CausesValidation="true"
                   OnClientClick="ValidateAndHideMPEPopup()"  
                   />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
I have a text area in my form which accepts all possible characters from
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.