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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:25:32+00:00 2026-05-16T16:25:32+00:00

I’m trying to implement a Widget control that exists on every page in the

  • 0

I’m trying to implement a Widget control that exists on every page in the system, which will allow the user to have basic Search & Directory functionality available on each page. This is a tab control defined below, where in the <ul> the currently selected tab is determined by the the value in Model.CurrentTab and the corresponding content that I want to display (basically, make visible) is also determined by that value.

<div class="WidgetControl">

    <ul class="WidgetTab tabs">
        <li <%= (Model.CurrentTab == "Search") ? "class='active'" : "" %>>
            <span href='<%= Url.Action("SearchBox", "Search") %>'>Search</span>
        </li>

        <li <%= (Model.CurrentTab == "Directory") ? "class='active'" : "" %>>
            <span href='<%= Url.Action("DirectoryList", "Group") %>'>Directory</span>
        </li>
    </ul>

    <div id="Search" class="tab_container">
        <% Html.RenderAction("SearchBox", "Search"
                    , (Model.CurrentTab == "Search") ? Model.Search : ""); %>
    </div>

    <div id="Directory" class="tab_container">
        <% Html.RenderAction("DirectoryList", "Group"
                    , (Model.CurrentTab == "Directory") ? Model.Search : ""); %>
    </div>
</div>

The reason I want to load both Search and Directory is so the page doesn’t have to request the content depending on which tab is clicked. I want it all to be available immediately.

The problem I’m having is that if CurrentTab contains the value “Directory” this means (I assumed) that Html.RenderAction("SearchBox"... should pass in an empty string. But when it gets to the action method, the View Model passed into SearchBox contains a value and not ""

I don’t understand why this is happening. Even when I pass an empty string into SearchBox, the View Model still contains a value. Can somebody please explain what’s going on? Should I be doing this differently?

update:

    public PartialViewResult DirectoryList(DirectoryViewModel vm)
    {
        return PartialView(vm.Search); // this is expecting a string
    }

    public PartialViewResult SearchBox(SearchViewModel vm)
    {
        return PartialView(vm); // the among other things, the Search string is used
    }

Both DirectoryViewModel and SearchViewModel contain a property called Search

  • 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-05-16T16:25:32+00:00Added an answer on May 16, 2026 at 4:25 pm

    The ModelBinder will new() up any object in a ActionMethod’s parameters. I don’t think this behavior can be turned off without implementing your own modelbidner. You need to create an overload that has no parameters and route it accordingly.

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

Sidebar

Related Questions

I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6

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.