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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:30:02+00:00 2026-06-05T07:30:02+00:00

Experienced .Net developer but a complete ASP MVC (and web dev in general) novice.

  • 0

Experienced .Net developer but a complete ASP MVC (and web dev in general) novice. I’m looking for best practice architecture suggestions for how I should accomplish the following.

I have three jQuery-UI tabs: the first has an input textbox: <input type="text" name="username" \>. The others are loading a different page via AJAX (implicitly using jQuery) but need to know the value of this input field. How can I retrieve this value from the ASP MVC Controller of tab 2 or 3? Is this fundamentally a bad approach?

~/Views/Shared/_Layout.cshtml:

<!DOCTYPE html>
<html>
<head>
    @Styles.Render("~/Content/themes/base/css", "~/Content/css")
    @RenderSection("head", required: false)
</head>
<body>
    @RenderBody()
</body>
</html>

~/Views/Demo/Index.cshtml:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section head
{
    <link rel="stylesheet" href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" />
    <script src="@Url.Content("~/Scripts/jquery-1.6.2.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")"></script>
    <script>
        $(function() {
            $("#tabs").tabs();
        });
    </script>
}

<div id="tabs">
    <ul>
        <li><a href="#Tab1">Tab 1</a></li>
        <li><a href="/Tab2">Tab 2</a></li>
        <li><a href="/Tab3">Tab 3</a></li>
    </ul>
    <div id="Tab1">
        <p>Want to be able to get the value of the input field below from Tab2 and Tab3</p>
        <input type="text" name="username" />
    </div>
</div>

~/Controller/Tab2Controller.cs:

using System.Web.Mvc;

namespace MvcApplication1.Controllers
{
    public class Tab2Controller : Controller
    {
        public ActionResult Index()
        {
            //  I want to replace this line with one that takes the value of
            //  the input text box and queries the model for the real data
            ViewBag.MyList = new[] { "1", "2", "3" };
            return View();
        }
    }
}

~/Views/Tab2/Index.cshtml

@{
    Layout = null;
}

<ul>
    @foreach (var obj in ViewBag.MyList)
    {
        <li>@obj</li>
    }
</ul>

Thanks.

  • 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-05T07:30:03+00:00Added an answer on June 5, 2026 at 7:30 am

    Change the controller action to receive the username.

    public class Tab2Controller : Controller
    {
       public ActionResult Index(string userName)
       {
           //  I want to replace this line with one that takes the value of
           //  the input text box and queries the model for the real data
            ViewBag.MyList = new[] { "1", "2", "3" };
    
            return View();
        }
    }
    

    Update the href of tabs (2 & 3) on select event.

    $(function() {
       $("#tabs").tabs({
          select: function(event, ui) {
              if(ui.index == 1 || ui.index == 2) // if the tab is 2 or 3.
              {
                // select the user name
                var username = $("#Tab1 input[name='username']").val();                                
    
                if(username){
                    var url = "/Tab" + (ui.index + 1) + "?userName=" + username;
                    $("#tabs").tabs( "url" , ui.index , url );
                }
              }
          }
       });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I am an experienced web developer but sometimes ASP.Net is tricking me. I
As a fairly experienced ASP.Net developer just recently starting using MVC, I find myself
I am an experienced .NET developer but new to EF - so please bear
I'm a fairly experienced .NET desktop developer, but I'm new to Silverlight. I'm trying
I need to learn nHibernate from scratch. I'm a experienced .net developer, but I
I'm a fairly experienced web developer, but I've never needed to work with video
I'm a decently experienced .net developer for the desktop but this is my first
I'm an experienced asp.net developer who has begun developing in php, specifically in wordpress.
I'm an experienced developer who has been working with .Net for the last 5
I need an opinion and advise from experienced ASP.NET people, what way to go.

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.