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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:52:01+00:00 2026-06-03T21:52:01+00:00

The view is visible for a quick second in the dialog, then the dialog

  • 0

The view is visible for a quick second in the dialog, then the dialog is gone and the view is visible again in the mainsite as if there would be javascript disabled.

What do I wrong? I just want to show the Create view in the dialog which is calling the Create action in the controller.

Index view:

@{
    Layout = null;   
 }

 <script type="text/javascript">

    $(function () {
        $('#dialog').dialog({
            autoOpen: false,
            width: 300,
            resizable: false,
            title: 'Create Template',
            modal: true,
            open: function(event, ui) {               
                $(this).load("@Url.Action("Create")");
            },
            buttons: {
                "Close": function () {
                    $(this).dialog("close");
                }
            }
        });

        $('#CreateTemplate').click(function ()
        {
            $('#dialog').dialog('open');
        });
    });

<div id="dialog" title="Create Template" style="overflow: hidden;"></div>
<div id="MenuBarDiv">   
    <a id="CreateTemplate" href="..\Template\Create">Create Template</a>
</div>
<div id="LeftDiv">
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
    teimata sanctus est Lorem
    ipsum dolor sit amet.
</div>
<div id="RightDiv">
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
    tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero
    eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea

</div>
<div class="clear">
</div>

Controller:

  [HttpGet]
    public ActionResult Create()
    {
      return View("Create");
    }
  • 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-03T21:52:02+00:00Added an answer on June 3, 2026 at 9:52 pm

    In the click handler of the anchor you are not canceling the default action and so the browser simply redirects to the anchor’s href without leaving any time for the dialog to show. If you want to stay on the same page you need to cancel this default action by returning false:

    $('#CreateTemplate').click(function () {
        $('#dialog').dialog('open');
        return false;
    });        
    

    Also make sure that in your Create.cshtml partial you have canceled the layout (Layout = null) or have your Create action return a PartialView instead of View to avoid getting the full layout inside the dialog.

    Another improvement for your code would be to replace the following hardcoded anchor:

    <a id="CreateTemplate" href="..\Template\Create">Create Template</a>
    

    with a html helper to ensure that it generates proper url respecting your routes configuration:

    @Html.ActionLink(
        "Create Template",             // linkText
        "Create",                      // actionName
        "Template",                    // controllerName
        null,                          // routeValues
        new { id = "CreateTemplate" }  // htmlAttributes
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The question is about android Spinners working when Gone and then Visible again. I've
I've a RelativeLayout thus: <RelativeLayout> <TextView1/> <TextView2/> // <-- View.VISIBLE OR View.GONE <TextView3/> <TextView4/>
I would like to make popover view visible whenever user switches from landscape view
I have 4 Views and I want that the first View gets Visible then
I have root view with both tab bar and navigation bar visible at the
I wanted to put a background image partially visible behind a list view. I
In app I have: LinearLayout linearLayout2 = (LinearLayout) findViewById(R.id.cvLinearLayout2); and after : linearLayout2.setVisibility(View.GONE); I
I am using a custom title view and would like to show/hide a progressbar
I seem to be getting application crashes at: parent.findViewById(R.id.a_1).setVisibility(View.VISIBLE); not sure what im doing
This is what I am doing ProgressBar myProgressBar = (ProgressBar) findViewById(R.id.progressBar); myProgressBar.setVisibility(View.VISIBLE); fetchData(); mainView();

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.