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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:22:09+00:00 2026-05-31T06:22:09+00:00

I am currently working on a ASP.NET MVC 3 project in which I need

  • 0

I am currently working on a ASP.NET MVC 3 project in which I need to build a report builder. The report model has to be generic and just be “implemented” for any report. The report has certain criteria that should be met: these are the “Filter Values”, which is in the form op select lists, and Include additional information (yes-no-option), that can be any child entity that has to be included in the report, and finally the layout of the report which is a enum. Here is the code i have so far for the report builder model:

public class ReportBuilderModel
{
  public IList<FilterModel> FilterCriteria { get; set; }
  public Dictionary<string, bool> AdditionalInformation { get; set; }
  public ReportType ReportType { get; set; }
  public String ReportName { get; set; }

  public ReportBuilderModel()
  { 
  }

  public ReportBuilderModel(string reportName)
  {
    FilterCriteria = new List<FilterModel>();
    AdditionalInformation = new Dictionary<string, bool>();
    ReportName = reportName;
  }

  public void AddFilterCriteria(String fieldName, Object lookupObject)
  {
    FilterModel model = new FilterModel()
    {
      FieldName = fieldName,
      LookupObject = lookupObject
    };
    FilterCriteria.Add(model);
  }

  public void AddAdditionalInformation(String fieldName, bool defaultValue)
  {
    AdditionalInformation.Add(fieldName, defaultValue);
  }
}

public class FilterModel
{
  public String FieldName { get; set; }
  public Object LookupObject { get; set; }
}

public enum ReportType
{
  Detail,
  List,
  Form,
  Transaction
}

The view associated with this is as follows:

    @model EduTOOL.Models.ReportBuilderModel
    @{
        ViewBag.Title = "Report Builder";
    }
    @Html.LoadPartial(EduTOOL.Controllers.PartialViewName._EditorForLibraries)
    @using (Html.BeginForm())
    {
        <h2>
            Build Report for @Model.ReportName</h2>
        <div style="float: left; width: 35%; height: 20%;">
            <fieldset>
                <legend>Filter Criteria</legend>
                <table>
                    @foreach (var filter in Model.FilterCriteria)
                    {
                        String displayText = "Select a " + filter.FieldName;
                        <tr>
                            <td>@Html.DisplayFor(label => displayText)
                            </td>
                        </tr>
                        <tr>
                            <td>@Html.EditorFor(editor => filter.LookupObject)
                            </td>
                        </tr>                                           
                    }
                </table>
            </fieldset>
        </div>
        <div style="float: left; width: 35%; height: 20%;">
            <fieldset>
                <legend>Options</legend>
                <table>
                    @foreach (var includeInfo in Model.AdditionalInformation)
                    {
                        String displayText = "Include " + includeInfo.Key + " information?";
                        <tr>
                            <td>@Html.DisplayFor(label => displayText)
                            </td>
                        </tr>

                        <tr>
                            <td>
                                @Html.EditorFor(includeValue => includeInfo.Value)
                            </td>
                        </tr>               
                    }
                </table>
            </fieldset>
            <br />
            <br />
        </div>
        <div style="float: right; width: 30%; height: 20%;">
            <fieldset>
                <legend>Report Type</legend>
                <br />
                <table>
                    @foreach (var reportType in Enum.GetValues(Model.ReportType.GetType()))
                    {
                        <tr>
                            <td>
                                @Html.DisplayFor(displayText => reportType)
                            </td>
                            <td>
                                @Html.RadioButtonFor(radio => reportType, reportType.ToString())
                            </td>
                        </tr>                                    
                    }
                </table>
            </fieldset>
            <br />
            <br />
        </div>
        <br />
        <input class="button cyan" value="Generate Report" type="submit" />
    }

These are all called by these action controller methods:

  public ActionResult TestReport()
  {
    ReportBuilderModel model = new ReportBuilderModel("Distributor Contact List");
    model.AddFilterCriteria("Distributor", DistributorController.GetDefaultAutoComplete());
    model.AddFilterCriteria("Status", ActiveStatus.Active);

    model.AddAdditionalInformation("Contact", true);
    model.AddAdditionalInformation("History", true);

    return View(model);
  }

  [HttpPost]
  public ActionResult TestReport(ReportBuilderModel model)
  {
    return View();
  }

The trouble is no binding occurs between the HTTPGET and HTTPPOST for the model, and I dont know exaclty how to bind the models? Also i would like to know if this is a good way to build a report wizzard? The values that are chosen in the report builder wizzard will be handled by the controller that makes use of the builder. The idea here is to get a list of selected criteria for the three options and generate the report using that criteria.

I am not allowed to use 3rd party controls. Any help will be appreciated. Thank you so much!

  • 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-31T06:22:11+00:00Added an answer on May 31, 2026 at 6:22 am

    because you are binding to a list of FilterCriteria it doesn’t know how to bind it because it needs the name property set. Basically you have a bunch of input elements on the screen but you havn’t given them a name so that it can identify which on to bind to on the post.

    Here is a good article on model binding. I would suggest binding something simple at first, like a text box. The move up to list and a list of objects inside another object. Model Binding

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

Sidebar

Related Questions

I am currently working on a ASP.NET MVC 3 project in which I have
I'm currently working on an ASP.NET MVC project using NHibernate and I need to
I am currently working on a project that consists of an ASP.NET MVC 2.0
I am working with an ASP.NET MVC project which was originally started from the
I am working on an ASP.NET MVC project which allows users to construct arbitrarily
I'm just starting out learning ASP.NET MVC. I'm working on a project created with
I'm currently working on an Intranet application project, using ASP.NET MVC 3. One of
I am currently working on another issue in my ASP.NET MVC project. In an
I'm currently working on an ASP.net MVC web site project. I've put all database
I am currently working on a ASP.NET MVC 3 project and I am setting

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.