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 8439171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:56:07+00:00 2026-06-10T07:56:07+00:00

In my code behind file i am calling an html modal popup which prompts

  • 0

In my code behind file i am calling an html modal popup which prompts the user for their username and password.
i would like to get a result back from this to my code behind calling function before proceeding.
how do i do this? Right now the modal form is shown and the c# code continues processing which makes sense but its not what i want.
Note: The modal signoff html modal form has a button (btnSignoff) that calls some other code behind function
thanks
Damo

Code behind:

SignoffModal.Show();
//Wait for response (this is what i would like to be able to do)
if (result <0)
{
//throw some error
}

else
{
// Do some more work
}

HTML Code:

 <!-- Signoff Modal Form -->
                <asp:HiddenField ID="SignoffForModal" runat="server" />
                <ajaxToolkit:ModalPopupExtender runat="server" ID="SignoffModal" BehaviorID="modalPopupExtenderSignoff"
                    TargetControlID="SignoffForModal" PopupControlID="popUpPaneSignoff" OkControlID="btnSignoff"
                    BackgroundCssClass="modalBackground">
                </ajaxToolkit:ModalPopupExtender>
                <asp:Panel ID="popUpPaneSignoff" runat="server" CssClass="confirm-dialog">
                    <asp:Label ID="lblUsername" runat="server" Text="Username"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtUserName" runat="server" ToolTip="Username" Width="200px"></asp:TextBox>
                    <br />
                    <asp:Label ID="lblPassword" runat="server" Text="Password"></asp:Label>
                    <br />
                    <asp:TextBox ID="txtPassword" runat="server" ToolTip="Password" TextMode="Password"
                        Width="200px"></asp:TextBox>
                    <br />
                    <br />
                    <div class="base">
                        <asp:Button ID="btnSignoff" runat="server" Text="Signoff" />
                        <asp:LinkButton ID="LinkButton3" runat="server" CssClass="close" OnClientClick="$find('modalPopupExtenderSignoff').hide(); return false;" /></div>
                </asp:Panel>
                <!-- End Signoff Modal Form -->
  • 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-06-10T07:56:08+00:00Added an answer on June 10, 2026 at 7:56 am

    Looks like the ModalPopupExtender isn’t designed this way. While it is modal (prevents the user from interacting with the rest of the page), it’s not blocking, mean code continues to run after the form is called. That’s because the popup is running on the client, and the code-behind runs the server. This is called a callback because the client code calls back to the server when a action is taken.

    To make this work, you have to split the logic you after SignoffModal.Show(); in an “Ok” part and a “Cancel” part by adding a CancelControlID attribute on ModalPopupExtender to point to the button that handles the Cancel action, then add the button:

      <!-- Signoff Modal Form -->
    <asp:HiddenField ID="SignoffForModal" runat="server" />
    <ajaxToolkit:ModalPopupExtender runat="server" ID="SignoffModal" 
        BehaviorID="modalPopupExtenderSignoff"
        TargetControlID="SignoffForModal" 
        PopupControlID="popUpPaneSignoff"     
        OkControlID="btnSignoff" 
     // points to cancel button action
        CancelControlID="btnCancel" 
     BackgroundCssClass="modalBackground">
    

    …

    <asp:Button ID="btnSignoff" runat="server" Text="Signoff" />
        // handles Cancel action...
        <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
        ...
    <!-- End Signoff Modal Form -->
    

    in the btnSignoff code-behind event handler:

    {
    // Do some work...
    

    in the btnCancel code-behind event handler:

    {
    //throw some error...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a Silverlight User Control's code behind file there is a method, to which
I have a Xaml file that does not have any code behind. I would
On postback : How can I access ASP.NET controls in my code-behind file, which
I'm building a html table dynamically in an ASP.NET code behind file using C#.
I am trying to add dynamic HTML elements from the code behind file on
I have a C# code behind file that gets dynamically generated HTML from a
The code behind file creates a list of employees and the asp.net page loops
I had a code segment on an asp.net page in the code-behind file. I
I'm trying to create datagrid tooltip entirely in code behind file. Tooltip XAML code
I have a executable jar file and i want to see code behind it.

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.