I have following textbox within a Gridview:

<asp:TextBox ID="due" runat="server" TextMode="Date" Text='<%# Bind((Convert.ToDateTime(Eval("due")).ToString("yyyy-MM-dd"))) %>'></asp:TextBox>

This does not work. I get a Parser-error: A call to Bind was not well formatted. Please refer to documentation for the correct parameters to Bind.

When I use that expression without "Bind()" the textbox shows datepicker and stored date as desired, but when updating is clicked, no date is updated (because it is only ...Eval...). What is the correct Syntax for Binding that two-way?

I have a standard Edit action in Asp.Net MVC 5 and I want to avoid throwing the unhandled exception when a get request is made without the id like ~/food/edit, so I did this.

    public ActionResult Edit(int id = 0)
    {
        if (id == 0)
        {
            return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        }

        string result = _foodAppService.GetById(id);
        FoodVm food = string.IsNullOrEmpty(result) 
            ? null 
            : JsonConvert.DeserializeObject<FoodVm>(result);

        if (food == null)
        {
            return RedirectToAction("Index");
        }

        return View(food);
    }

My question is: Is it a good practice to handled it in this way or there are more suitable strategies ?

I'm new to this asking question thing, if a should I ask in another way, just let me know, thank you for your time.

I have a Layout page and a PartialView.

I have a search-button on the layout page and an update-button in a table in the partial view.

Once I click the search-button the update-button stops working. It works fine until I search. I'm guessing it has to do with the forms and actionresult but I can't get it to work. The actionresult is never reached - "nothing" happens.

Image of the problem

Controller - RegisterTruckUser

[HttpPost]
        public ActionResult RegisterTruckUser(string registerName, string registerPassword, string employeeNumber, string userTeam)
        {
            var model = new RegisterModel
            {
                UserList = db.SearchTruckUsers(""),
                UserTeamList = GetUserTeamList(),
                TriggerOnLoad = true
            };

            //If the Save button is clicked the user is updated
            if (Request.Form.AllKeys.Contains("btnupdateuser"))
            {
                if (!Request["btnupdateuser"].IsEmpty())
                {
                    Name = Request.Form["item.Name"];
                    password = Request["item.Password"];
                    EmployeeNumber = Request["item.EmployeeNumber"];
                    Userteam = Request["item.UserTeam"];

                    db.UpdateTruckUser(Name, password, EmployeeNumber, Userteam);
                    model.UserList = db.SearchTruckUsers("");
                    return PartialView(model);
                }
            }
                ModelState.Clear();
                return View(model);
            }
            model.TriggerOnLoadMessage = ErrorMessage;
            return View(model);
        }

Controller - SearchPartialView

[HttpPost]
        public PartialViewResult SearchPartialView(string searchUserString)
        {
            if (Session["myID"] == null)
            {
                ExpireSession();
            }

            if (!ModelState.IsValid)
                RedirectToLogin();

            if (searchUserString.Any(char.IsDigit))
            {
                var model1 = new RegisterModel
                {
                    TriggerOnLoad = false,
                    UserList = db.SearchTruckUsersEmpNum(searchUserString),
                    UserTeamList = GetUserTeamList()
                };
                return PartialView("_RegisterTruckUserPartialView", model1);
            }

            var model = new RegisterModel
            {
                TriggerOnLoad = false,
                UserList = db.SearchTruckUsers(searchUserString),
                UserTeamList = GetUserTeamList()
            };
            return PartialView("_RegisterTruckUserPartialView", model);
        }

RegisterLayout

@model Name.Models.RegisterModel

<!DOCTYPE html>
<html lang="en">
<head>
    <title>@ViewBag.Title - Register</title>
    @Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.min.js")
</head>

<body>
    @RenderPage("~/Views/Shared/_Header.cshtml")
    @RenderBody()
    <div class="center" id="top">

                    <div id="search" class="active">
                        <h1>Manage users</h1>

                        @using (Ajax.BeginForm("SearchPartialView", "Register", null,
            new AjaxOptions
            {
                HttpMethod = "POST",
                InsertionMode = InsertionMode.Replace,
                UpdateTargetId = "divUsers",
            }, new
            {
                id = "usertable"
            }))
                        {

                            @Html.TextBox("SearchUserString", null, new { @class = "responsivetextbox", @placeholder = "Search username or employment number" })
                            <p>
                                <input type="submit" class="standardbutton logsearch" name="submit" value="Search" />
                            </p>
                        }
                        <div id="divUsers">
                            @{Html.RenderPartial("_RegisterTruckUserPartialView");}
                        </div>
        </div>
    </div>

    @RenderPage("~/Views/Shared/_Footer.cshtml")
</body>
</html>

PartialView (table)

<table class="centeredTable">
        <thead>
            <tr>
                <th>Name</th>
                <th>Password</th>
                <th>Employment Number</th>
                <th>Team</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
        @foreach (var item in Model.UserList)
        {
            using (Html.BeginForm())
            {
                <tr id="usertabletr1">
                    <td id="usertabletd1">
                        @Html.EditorFor(modelItem => item.Name, new {htmlAttributes = new {@name = "test1", @style = "border: 0px none;"}})
                    </td>
                    <td id="usertabletd1">
                        @Html.EditorFor(modelItem => item.Password, new {htmlAttributes = new {@name = "registerPassword", @type = "password", @style = "border: 0px none; "}})
                    </td>
                    <td id="usertabletd1">
                        @Html.EditorFor(modelItem => item.EmployeeNumber, new {htmlAttributes = new {@name = "employeeNumber", @readonly = "readonly", @style = "border: 0px none; background: white;"}})
                    </td>
                    <td id="usertabletd1">
                        @Html.DropDownListFor(modelItem => item.UserTeam, Model.UserTeamList, item.UserTeam, new {htmlAttributes = new {@name = "Team", @style = "border: 0px none;"}})
                    </td>
                    <td id="usertabletd1">
                            <input class="standardbutton adddefaultvaluesubmit" type="image" src="~/Pictures/saveicon.ico" alt="Save" value="Save" name="btnupdateuser"/>
                        <input class="standardbutton adddefaultvaluesubmit" type="image" src="~/Pictures/trashcanicon.ico" alt="Delete" value="Delete" name="btndeleteuser"/>
                    </td>
                </tr>
            }
        }
        </tbody>
    </table>

How to filter duplicate records in multiple columns.

I tried code:

select distinct col1,col2,col3 from collection   

and

select col1,col2,col3 from collection Group By col1,col2,col3  

I need to remove duplicate rows in col1,col2 and col3.
I tried with Group By keyword also but it displayed all duplicates also.

can anyone please tell how to do this.

Thank you

I want to display a pdf. My current code displayit using a pdf reader. But I want to open it in a seperate tab of the browser. How can i do it?

Here is my code

string name = ddlAppealList.SelectedValue.ToString();
int refNo = Convert.ToInt32(name);
string FilePath = Server.MapPath("~/filesPDF/" + refNo + ".pdf");
WebClient User = new WebClient();
Byte[] FileBuffer = User.DownloadData(FilePath);
if (FileBuffer != null)
{
     Response.ContentType = "application/pdf";
     Response.AddHeader("content-length", FileBuffer.Length.ToString());
     Response.BinaryWrite(FileBuffer);
}

Is it possible to allow people to upload videos on my Youtube channel to my website authentication in asp.net ? or

upload video in one youtube channel. different dieferent authentication but channel is same

I'm working on an old system that is using NHibernate 3 and spring for DI, I have to do some refactor on this solution. some of the projects of the solution was using NHibernate 1.2, I changed them to NHibernate 3. Now the only version of the NHibernate that is used in entire solution is 3.

Now the problem is when I try to load any of the web services in the solution, system try to load a type from NHibernate 1.2, I have tested published project in another system and it is working just fine, and it should be a problem with my system, it just give me: Could not load type 'NHibernate.Event.ListenerType' from assembly 'NHibernate, Version=1.2.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.

Can anyone help me find out why CLR is trying to load a type from an unreferenced assembly?

I have three configuration files, one for each environment:

  1. appsettings.json -> production
  2. appsettings.dev.json -> development
  3. appsettings.stg.json -> staging

If I set ASPNETCORE_ENVIRONMENT to dev, I get a runtime exception complaining about not being able to find appsettings.dev.json. I tried adding

"copyToOutput": [
  "appsettings.dev.json"
]

to the buildOptions section in project.json but it doesn't seem to have any effect.

Is there another way I can force appsettings.dev.json to be copied to the output directory?

I am currently preventing anonymous users access to my root application.

/web.config

  <system.web>
    <authorization>
      <deny users="?" />
    </authorization>
  </system.web>

But am allowing anonymous access to public resources (Images, CSS, etc.):

  <location path="Images">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

Now, I would like to add a virtual directory which should be accessible to anonymous users. I added a configuration based on the Images path, but whenever I try to access that location, I get redirected to the login page with the ReturnURL set to the virtual directory.

  <location path="virtualDirectory">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

In addition, I tried to specify the global authorization within my virtual directory's web.config but get an error saying I can only have that once

/virtualDirectory/web.config:

  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>

How can I allow anonymous access to a virtual directory when my root application is preventing anonymous access?

We have an application written in ASP.NET MVC which consists of Web (non rest, using razor) and API projects (and some other projects, but that is besides the point now). Authentication in Web is done using basic forms authentication and authentication in API is done using OAuth2. Having two ways of authentication in the same application has proven to be somewhat difficult to maintain so we decided to discard forms authentication and use OAuth2 for both Web and API projects. In Web project, we would probably have to store OAuth2 tokens in cookies instead of sending them as headers. Is it possible to use OAuth2 to secure "non-rest" applications, if so, are there some security concerns in doing so?

Background

I have some JSON which is deserialized to a Class which has DateTime properties.

Sometimes the corresponding elements of the JSON are null.

When you try to deserialize the JSON to the class an error is thrown because a plain old DateTime can't accept a null.

Easy but removes functionality

So the easiest resolution is to make the accepting properties of the class a nullable DateTime (DateTime?) but if you do that there's then a lot of DateTime methods you can no longer use on those properties.

Works but ... weird ?

So in looking for alternatives I have considered the following :

public class FooRelaxed
{
    [Required(ErrorMessage = "Please enter the id.")]
    public int? Id { get; set; }

    [Required(ErrorMessage = "Please enter the Start Date.")]
    public DateTime? StartDate { get; set; }

    [Required(ErrorMessage = "Please enter the End Date.")]
    public DateTime? EndDate { get; set; }

    public FooRelaxed() { }

    public FooRelaxed(
                  int? id,
                  DateTime? startdate,
                  DateTime? enddate)
    {
        this.Id = id;
        this.EndDate = enddate;
        this.StartDate = startdate;
    }
}
public class FooStrict 

    [Required(ErrorMessage = "Please enter the id.")]
    public int Id { get; set; }

    [Required(ErrorMessage = "Please enter the Start Date.")]
    public DateTime StartDate { get; set; }

    [Required(ErrorMessage = "Please enter the End Date.")]
    public DateTime EndDate { get; set; }

    public FooStrict() { }

    public FooStrict(FooRelaxed obj)
    {
        this.Id = Convert.ToInt32(obj.Id);
        this.EndDate = Convert.ToDateTime(obj.EndDate);
        this.StartDate = Convert.ToDateTime(obj.StartDate);
    }
}

I then use these classes to :

  • Deserialize the JSON to the class FooRelaxed, which has nullable DateTime properties
  • Validate the properties of the resulting object by calling Validator.TryValidateObject on it.
  • Assuming there are no errors then instantiate the 'shadow' class, FooStrict, which has non-nullable DateTime properties using the FooRexlaxed instance as an arg to the constructor
  • Use FooStrict for all subsequent processing

I'm sure there must be a better approach than this but I don't know what it is . Can anyone suggest a better solution ?

So we have some modals that are very similar in our ASP.Net MVC project and I want to set them up dynamically so that we don't have to have so many files strewn all over the place.

Once I've clicked a certain button and opened up the modal how do I check which button opened up the modal so I can do custom logic and inject specific html?

Button #1 :

<a class="btn btn-primary margin-bottom-5" data-toggle="modal" data-target="#newBugModal">
    <i class="fa fa-lg fa-fw fa-plus"></i> New Bug
</a>

<div class="modal fade" id="newBugModal" tabindex="-1" role="dialog" aria-labelledby="newBugModalLabel" aria-hidden="true">
    @Html.Partial("_bugModal")
</div>

Button #2 :

<a href="#" class="btn btn-default" data-toggle="modal" data-target="#bugEditModal">
    Edit
</a>

<div class="modal fade" id="bugEditModal" tabindex="-1" role="dialog" aria-labelledby="bugEditModalLabel" aria-hidden="true">
    @Html.Partial("_bugModal")
</div>

Customizeable Modal :

<div class="modal-dialog demo-modal">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                ×
            </button>
            <!-- CUSTOM LOGIC HERE (This is to set it as Bug Edit or New Bug)-->
            <h4 class="modal-title">Bug Edit || New Bug</h4>
        </div>
        <div class="modal-body">
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <!-- CUSTOM LOGIC HERE (This is to set prefilled text or placeholder text)-->
                        <textarea class="form-control" id="bug" rows="5" required>Specific Bug Error</textarea>
                    </div>
                </div>
            </div>           
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-primary">
                Save Changes
            </button>
        </div>
    </div><!-- /.modal-content -->
</div>

I know this is probably something simple but I can't quite put my finger on it and also whether or not I should be using jQuery to accomplish this or just some Razor code. Thoughts?

NOTE: Please do not point me to other answers or flag as duplicate without reading the question. There are a bunch of similar SO questions posted about this, and I have looked at most of them.

We are attempting to migrate a legacy web application eritten in VB.NET (ugh) to a new data center and are running into a problem with Crystal Reports (version 9.2). Specifically, when attempting to export to disk we get an error message saying

Unable to connect: incorrect log on parameters

Most answers have to do with data base issues, such as: installing the correct SQL drivers, getting ODBC datasource correct, database logins, user impersonation for database connection, and so on. None of these fit our scenario, because in our case there is no database in sight. Specifically, the data needed for the report is is passed in to it, so no database connection should be required. Here is the essence of the code:

        Dim dataModel As New ReportDataModel 'custom data model object to hold values
        LoadReportData(dataModel)  ' Call custom method to extract data model values **from controls on web page** 

        Dim crReportDocument As New ReportDocument ' Crystal object
        crReportDocument.Load(...)  ' arg here is path to a file that contains report template

        Dim parameter As ParameterFieldDefinition
        For Each parameter in crReportDocument.DataDefinition.ParameterFields
            SetReportParameters(parameter, dataModel) ' Call custom method to set value of each parameter from dataModel - 
        Next

        Dim crExportOptions As ExportOptions = crReportDocument.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskFileDestinationOptions 'gives destination file path
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With

        crReportDocument.Export() ' Exception here

Exception details:

Exception type: CrystalDecisions.CrystalReports.Engine.LogOnException
ErrorID: Logon Failed {6144}
Message: .../MyReport.rpt: Unable to connect: incorrect log on parameters

Any suggestions?

I am currently trying to load a cshtml page located in assembly resource with @Html.Partial which does not work and results in a MethodNotFoundException.

So what I've got so far is an self hosted application which runs the webserver.

If I remove the @Html.Partial {...} from Index.cshtml, the page will be displayed, otherwise it will throw an MethodNotFoundException while calling the ctor of ViewNotFoundExecption.

It looks like the engine tries to load the file from a directory, which does not exist. How do I tell the engine to look into the assembly resource?

Bootstrapper

    protected override void ConfigureApplicationContainer( TinyIoCContainer container )
    {
        var assembly = GetType().Assembly;
        ResourceViewLocationProvider.RootNamespaces.Add( assembly, "MyApp.Web.Views" );

        container.Register( typeof( IUserService ), typeof( UserService ) );


        base.ConfigureApplicationContainer( container );
    }

Views/Shared/_BaseLayout.cshtml

<html>
<body>
    // some html
    <div>
        @RenderBody()
    </div>
</body>
</html>

Views/Index.cshtml

@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<MainModel>
@{
    Layout = "Shared/_BaseLayout.cshtml";
}

<div>
    <h1>
        @Model.CurrentTime
    </h1>

    <h2>
        @{ Html.Partial( "PartialView", new MainModel() ); }
    </h2>
</div>

Views/PartialView.cshtml

@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<MainModel>
<p>Partial view @Model.CurrentTime</p>

Folder structure (every file is embedded as resource, and it works, except for @Html.Partial("PartialView"))

Views
    Index.cshtml
    PartialView.cshtml      
    Shared
        _BaseLayout.cshtml

On selecting a grid row the value should populate in the dropdown list which is already bind to the database please help me out

I have a C# page that contains a Gridview that is connected to a SQL query. A dropdown at the top of the page changes the SQL query dynamically. I then have a button that exports the gridview to Excel.

The export to excel command contains code to eliminate the gridview paging before export:

     //To Export all pages
     GridViewName.AllowPaging = false;
     GridViewName.DataBind();

The problem is, the GridViewName.Databind() resets my SQL query to show all the gridview records and not the filter. What am I doing wrong?

I have a form with a record number, then boxes for "primary" notes and effective date.

Then I have an optional "secondary" notes and effective date box.

When someone clicks on a button to edit the primary or secondary notes, it looks to see if the other notes have changed (a session variable set to "true" fires for the "textchanged" event for the other textbox). If so, instead of enabling the textbox that matched the "edit" button, it flashes a message saying to cancel or update the other textbox's changes.

My problem is that the contents of the textbox are being viewed as "changed" when nothing is changed. If I load the record, and run a separate validation check, it verifies that the contents of the textbox match with the data originally loaded into the textbox. Then, not changing anything, when I click on the "edit" button, that separate validation comes back as no longer matching, even though the information in the session variable and the textbox are both unchanged.

Here is my validation check -

        If Not Session("SN1") Is Nothing Then
        sesslst = sesslst & "<p>Sec Notes match = " & (Trim(Session.Item("SN1").ToString) = Trim(txtSecondaryNotes.Text)).ToString
        sesslst = sesslst & "<p>Sec Date match = " & (Trim(Session.Item("SD1").ToString) = Trim(txtSecEffDate.Text)).ToString
        sesslst = sesslst & "<p>S = " & Trim(Session.Item("SN1").ToString)
        sesslst = sesslst & "<p>F = " & Trim(txtSecondaryNotes.Text)
    End If
    lblTest.Text = sesslst

Here are the results after initial record load:

SN1 - Bill Smith (Father) 10/12/1971 Linda Smith (Mother) 7/22/1971 Boudreau W Smith (Brother) 6/7/1994

SD1 - 4/1/2014 12:00:00 AM

Sec Notes match = True

Sec Date match = True

S = Bill Smith (Father) 10/12/1971 Linda Smith (Mother) 7/22/1971 Boudreau W Smith (Brother) 6/7/1994

F = Bill Smith (Father) 10/12/1971 Linda Smith (Mother) 7/22/1971 Boudreau W Smith (Brother) 6/7/1994

(all specific data in this example has been changed, so no real personal information is being displayed)

When I click the edit button and that validation loop runs again, the "Sec Notes changed" value changes to "false," but nothing else changes.

Initially, I had the session variable for the record change set for the "TextChanged" event. When it kept setting, despite no change, I added additional validation within the change event. If both the notes and dates session variable do not match the field information, it sets another session variable as changed -

    Protected Sub txtSecondaryNotes_TextChanged(sender As Object, e As EventArgs) Handles txtSecondaryNotes.TextChanged, txtSecEffDate.TextChanged
    If Not ((Trim(Session.Item("SN1").ToString) = Trim(txtSecondaryNotes.Text)) And (Trim(Session.Item("SD1").ToString) = Trim(txtSecEffDate.Text))) Then
        Session.Item("secondaryEditing") = True
    End If

End Sub

I never get passed the check for the "secondaryEditing" session variable when I click the edit button (the lstSess() proc just lists all the session variable names and values so I can see what's being compared) -

    Protected Sub btnEditPrimary_Click(sender As Object, e As EventArgs) Handles btnEditPrimary.Click
    txtPolicy.Text = Trim(txtPolicy.Text).ToUpper
    lstSess()

    If Session.Item("secondaryEditing") = True Then
        secMsg.Visible = True
        Exit Sub
    Else
        secMsg.Visible = False
    End If

So, I thought the problem, initially, was maybe with the form, loading of data, and the TextChanged event firing but not being evaluated until the button was pushed, but even when I add in the additional If-->then validation within the event, it still thinks something has changed, when the data in the field has not even been enabled, let alone manipulated.

How can I get this to honestly evaluate whether the text in the field has changed? FYI - the asp:TextBox objects have been set with and without "AutoPostBack = 'true'" with no difference in how it runs.

I'd like to know what I'm missing regarding disabling these via js only, and not having to add repeat code in the code behind.

I'm using this code to disable / enable Validators:

validator: {
        enable: function (id) {
            console.log('enable',id);
            var validator = document.getElementById(id);
            ValidatorEnable(validator, true);
        },
        disable: function (id) {
            console.log('disable',id);
            var validator = document.getElementById(id);
            ValidatorEnable(validator, false);
        }
    },

It works great, until i make a postback to save some data, ... where these disabled validators are not disabled.

So i have to run some repeated code within the OnLoad() if IsPostBack is true to disable the validators I've disabled via js already.

Edit: Removed any code as it wasn't required to achieve an answer. Answer: Server side must also disable the elements, can't be done explicitly for these reasons: found here, thanks to @ConnersFan: https://msdn.microsoft.com/en-us/library/aa479045.aspx

  • Some validation controls may not support client scripting. A good example: if you are using a CustomValidator with a server validation function but no client validation function.
  • Security considerations. Someone can very easily take a page with script and disable or change it. You should not rely on script to stop bad data getting into to your system, only to provide more immediate feedback to your users. For this reason, if you are using a CustomValidator, you should not provide a client validation function without a corresponding server validation function.

I have just completed a website for a customer using ASP.NET Razor C# protocol, but NOT MVC. It appears to work fine. However, if the user requests an input screen with a form then does not enter anything for 5-10 minutes and then inputs a request, the request is not honored. The session timeout in web.config is set to 24 hours, as per the customer's request.

I set a function to log what was happening. When a user starts the website, Session_Start is called, then _SiteLayout.cshtml. From there, as long as the user does not wait, everything works fine. Any new request goes through _SiteLayout.cshtml and is vectored to the correct page. However, if the user does wait, when a request is made after the wait, the server calls Session_Start again rather than just calling _SiteLayout.cshtml. Since I use Session_Start to initialize my environment, all of the variables are set to initial values all of the entered data is lost. The sessionid is the same for both entries to Session_start

I suspect there is an underlying timeout value (http.response.timeout?) that is causing the problem, but I have not been able to determine how to programmatically set this for each and every browser.

Any help is appreciated.

I am trying to send back the checkbox value back to the controller. The checkbox does not recognise the change in the checkboxfor and keep sending the values it got when I generated the page.

Could anyone explain where I have got it wrong? I have looked at few examples and unfortunately they do not fullfill my requirements.

My Class

public class SomeClass
{
    public Guid Id { get; set; }
    public string Name { get; set; }
    public bool IsEnabled { get; set; }
}

My Controller

    [HttpPost]
    public ActionResult Index(Guid id,bool check = false)
    {
        try
        {
            _importService.EnableDisable(id, check);
            return RedirectToAction("Index");
        }
        catch (Exception ex)
        {
            LogError(ex.Message, ex);
            throw;
        }
    }

Razor Code

  <html>
<head>
    <title>Values</title>
</head>
<body>
<div>
    <h4>Current Values</h4>
    <table>
        @foreach (var m in Model)
        {
            <tr>
                <td><a href="@Url.Action("ExtraInfo", "MyAction", new {id = m.Id})">@m.Name</a></td>
                <td>                 
                    @using (Html.BeginForm("Index", "MyAction", new { id = m.Id, check = m.IsEnabled }, FormMethod.Post, null))
                    {
                        @Html.HiddenFor(m => SomeClass.Id)
                         @Html.CheckBoxFor(m => SomeClass.IsEnabled)

                        <input type="submit" value="Save" />
                    }
                </td>
            </tr>
        }
    </table>
</div>
</body>
</html>

The Save button appears like this

I need to create a view in MVC5 that contains several partial views. The view represents a report for a specific person. The report can be displayed for a given date. Its likely that the partial views will change over time and that new versions of the views will be added to the project. There will be a database table that specifies which version of a given view was "active" for a given date range.

What design pattern would you use to manage adding new versions of the views and which set of views was active on a given date? Any examples would be greatly appreciated.