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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:19:14+00:00 2026-06-07T05:19:14+00:00

i have a partial view in my website, shared among many pages, for searching

  • 0

i have a partial view in my website, shared among many pages, for searching functionality, consisting of:
from date
to date
file type
file name

now,the problem is, in some pages i dont want the file type to be included, in other pages i dont want the (from-to) date criteria to be included

what should i do? should i create a partial view for each functionality? or show/hide the criteria from within?

_Filters.cshtml

@model Entities.FilterOperations
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
        <td class="formtit">
            Start Date
        </td>
    </tr>
    <tr>
        <td>@Html.TextBoxFor(m => m.StartDate, new { @class = "date" })
        </td>
    </tr>
    <tr>
        <td class="formtit">
            End Date
        </td>
    </tr>
    <tr>
        <td>@Html.TextBoxFor(m => m.EndDate, new { @class = "date" })
        </td>
    </tr>
  <tr>
        <td class="formtit">
            File Type
        </td>
    </tr>
    <tr>
        <td>@Html.TextBoxFor(m => m.FileType)
        </td>
    </tr>
    <tr>
        <td class="formtit">
            File Name
        </td>
    </tr>
    <tr>
        <td>@Html.TextBoxFor(m => m.FileName)
        </td>
    </tr> <tr>
        <td align="right">
            <input type="submit" value="Search" />
        </td>
    </tr>
</table>
  • 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-07T05:19:15+00:00Added an answer on June 7, 2026 at 5:19 am

    Just add a few properties to your FilterOperations model like:

    public bool RenderFileType {get; private set;}
    public bool RenderDateTo {get; private set;}
    

    With a new ctor:

    public FilterOperations(bool renderFileType = true, bool renderDateTo = true) {
        RenderFileType = renderFileType;
        RenderDateTo = renderDateTo;
    }
    

    Now you can set conditions in your partial like so:

    @if(Model.RenderFileType) {
    <tr>
        <td>@Html.TextBoxFor(m => m.FileType)
        </td>
    </tr>
    }
    

    Then in your view call your partial like so:

    @Html.Partial("_Filters.cshtml", new FilterOperations(renderDateTo: false))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Partial View used in many pages and I was wondering if
I have a partial view that is shared between two controllers and I'm trying
I have two partial view and I want to call one of them in
I have a partial view of a row for the table. Each row in
I have a partial view which is displayed on the top right of every
I have a partial view that I want to basically take care of itself
I have a partial view (UserControl) that implements a simple pager in my Asp.Net
I have a partial view which contain JavaScript and Ajax, but does not run
I have a partial view that I have created called noteEditor. That is rendered
I have a partial view the returns an HTML5 video tag. I want to

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.