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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:59:58+00:00 2026-06-12T01:59:58+00:00

I have the following method in aspx code behind which displays a jquery dialog.

  • 0

I have the following method in aspx code behind which displays a jquery dialog. Is it possible for this method to return true if the user clicks “Submit” on the dialog?

    Sub DisplayDialog()
        Dim title As String = "title"
        Dim content As New StringBuilder()
        content.Append(@"<script type=text/javascript>
          $(function () {
           $('#dialog')
            .dialog({
            title: 'title',
            modal: 'true',
            buttons: {
                'Submit': function () { 
                },
                'Cancel': function () {
                    $(this)
                        .dialog('close');
                }
            }
        });
    });
</script>")
     ClientScript.RegisterStartupScript(Me.[GetType](), title, content.ToString())
    End Sub

EDIT:

Here is a more complete picture of what I have:

Sub GridView1_onRowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
    Select Case e.CommandName
        Case "Upload"
            DisplayDialog()
            //Get result here from jquery dialog. Do something if result was true             
        Case "Something"
     End Select
End Sub
  • 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-12T01:59:59+00:00Added an answer on June 12, 2026 at 1:59 am

    If you want to use the return of the Modal Dialog in order to perform an action, this is the pattern you should follow:

    <script type="text/javascript">
        $(function () {
            var $dialog = $("#dialog");
            var $foo = $("input:submit[id$=foo]");
            var confirmed = false;
    
            $dialog.hide();
    
            $dialog.dialog({
                width: "300px",
                modal: true,
                autoOpen: false,
                buttons: {
                    OK: function (e) {
                        $dialog.dialog("close");
                        confirmed = true;
                        $foo.click();
                    },
                    Cancel: function (e) {
                        $dialog.dialog("close");
                        confirmed = false;
                    }
                }
            });
    
            $foo.click(function (e) {
                if (!confirmed) {
                    $dialog.dialog("open");
                }
    
                return confirmed;
            });
        });
    </script>
    
        <div>
            <asp:Button Text="Submit" runat="server" ID="foo" OnClick="foo_Click" />
        </div>
        <div id="dialog">
            <asp:Label Text="Are u sure u wanna do it?" runat="server" />
        </div>
    

    Basically you use a flag to indicate what button was pressed, and you return that flag when clicking a button.

    You could take this sample and adjust it to fit your specific needs

    This is the full working Example on my GitHub

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code snippet in jquery.In which,I want to animate each element of
I have the following code in my aspx code-behind and it works fine. Because
I have following method which I am using to load ActiveX control dynamically, Dim
I have the following method, which takes in the name of a file as
I have the following method: public string Phase(string phase) { return Phase 1; }
I have the following method which is called when the value Edit Class... is
Within a web form I have the following jQuery setup to call a method
I have the following ASPX code: <asp:ScriptManager ID=ScriptManager1 runat=server /> <asp:UpdatePanel runat=server ID=UpdatePanel UpdateMode=Conditional>
I have a aspx web page with no code behind and a few inline
I have the following code to post to an httppost method in my controller:

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.