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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:57:57+00:00 2026-06-08T05:57:57+00:00

The scenario I want to implement is stated as follows: I am using MVC

  • 0

The scenario I want to implement is stated as follows:

I am using MVC 3 with razor view.

On the click of text box (call it Result Text Box), open a dialog from the Home View (which is a different view, the Add View) and carrying a postback to Home controller action.

On the dialog (which is Add View), simply input two numbers for addition and on its submit, does a post-back on Add view controller action.

Now, when the Add controller action processing completes, I want to do the addition of the numbers and close the current dialog (Add View) and updating the Result Text Box present on the parent view (Home view) with the addition result.

Note: After closing the dialog I dont want the parent view to be reloaded or refreshed.

Now, Where I am facing the problem is how to

1) fetch hidden field value (container addition value) and set to the Result test box on parent page?

2) close the dialog(add view) from the dialog itself? without refreshing the parent view?

code:

<h2> Input numbers to add</h2>
    @using (Html.BeginForm("About","Home",FormMethod.Post, new {id = "dialogchildform"}))
    { 

         @Html.Hidden("hdnresult", ViewData["result"], new { id = "hdnres" })

    <div style="position: relative; margin-left: 200px; top: 80px">

        <fieldset>


            @Html.ValidationSummary(true)
            <div class="editor-label">
                Value 1
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.num1, new { id = "num1" })
                @Html.ValidationMessageFor(model => model.num1)
            </div>
            <div class="editor-label">
                Value 2
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.num2, new { id = "num2" })
                @Html.ValidationMessageFor(model => model.num2)
            </div>
        </fieldset>
        <p>
            <input type="submit" value="Add and Retrun" id="inputSubmit" />
        </p>
    </div>

    }




    <script type="text/javascript">

           $(document).ready(function () {
               $("#inputSubmit").click(function () {

                   document.forms('dialogchildform').submit();

            // txtParentResult is a Textbox on prent view to be updated
                   document.getElementById('txtParentResult').value 
= document.forms('dialogchildform').hdnres.value; 
// not updating the parent textbox


                  // $(window.document).dialog('close');  
//gives error - Microsoft JScript runtime error: Object doesn't support property or method 'dialog'
                  //$("#mydiag").dialog("close");  
// also gives error

                  //jQuery(".ui-dialog-content").dialog("close");  
// again gives error -  Microsoft JScript runtime error: Object doesn't support property or method 'dialog'


               });        
           });

    </script>

Controller Action:

[HttpPost]
        public ActionResult Add(AddNum vAddNum)
        {
            objAddNum = vAddNum;
            int result = objAddNum.AddNumbers();
            ViewData["_ActionCloseDialog"] = "true";
            ViewData["result"] = result;
            return View();
        }
  • 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-08T05:57:59+00:00Added an answer on June 8, 2026 at 5:57 am

    Got the solution.

    Instead of using the jQuery function on the dialog view, I have used dialog buttons on the parent view itself.

    Since, the dialog is defined as global varibale in javascript function on the parent .cshtml and encapsulates child view in the div, has access to controls on both the views.

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

Sidebar

Related Questions

I want to implement delete confirmation dialog using FancyBox. The scenario is to pass
I want to implement a scenario where two endpoints can securely communicate with each
In an application having UITabBarController , I want to implement following scenario: When user
I want to implement the following scenario: When a user presses the Home key
I want to implement single sign on in my asp.net web application. Scenario is
We want to implement a client server application. here is the scenario. Server listens
Here is my scenario. I want to implement A* (in Python) without having to
Is there any scenario s where I would want to Implement IhttpModule ? I
I want to implement the scenario that I am giving the user some XML
I want to implement one-to-many concept in my application. This is the scenario: I

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.