Click here to Skip to main content
15,904,156 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: An Ajax Control is working on local machine not working on Server when deployed Pin
indian14329-Feb-16 11:10
indian14329-Feb-16 11:10 
QuestionASP.Net Pin
Member 1235142825-Feb-16 3:05
Member 1235142825-Feb-16 3:05 
AnswerRe: ASP.Net Pin
ZurdoDev25-Feb-16 4:09
professionalZurdoDev25-Feb-16 4:09 
AnswerRe: ASP.Net Pin
F-ES Sitecore25-Feb-16 21:52
professionalF-ES Sitecore25-Feb-16 21:52 
AnswerRe: ASP.Net Pin
Nathan Minier26-Feb-16 1:29
professionalNathan Minier26-Feb-16 1:29 
AnswerRe: ASP.Net Pin
Manas_Kumar26-Feb-16 7:17
professionalManas_Kumar26-Feb-16 7:17 
AnswerRe: ASP.Net Pin
aarif moh shaikh26-Feb-16 21:00
professionalaarif moh shaikh26-Feb-16 21:00 
QuestionPass ViewModel to view twice Pin
Member 1204569224-Feb-16 23:29
Member 1204569224-Feb-16 23:29 
I have the following index-method in my homecontroller:
C#
var homeIndexModel = new HomeIndexModel()
{
    ActiveTasks = tasks.Where(
        task =>
            task.TaskStatus != TaskStatusEnum.Deferred &&
            task.TaskStatus != TaskStatusEnum.Verified && task.TaskStatus != TaskStatusEnum.Resolved),
    ClosedTasks = tasks.Where(
            task =>
                task.TaskStatus == TaskStatusEnum.Resolved),
    DeferredTasks = tasks.Where(
        task =>
            task.TaskStatus == TaskStatusEnum.Verified ||
            task.TaskStatus == TaskStatusEnum.Deferred),
    Rules = m_errandSvc.GetAllRules(),
    Sources =
        Enum.GetValues(typeof(TaskSourceEnum)).Cast<TaskSourceEnum>().AsEnumerable().OrderBy(taskSource => taskSource.AsString()),
    Types =
        Enum.GetValues(typeof(TaskTypeEnum)).Cast<TaskTypeEnum>().AsEnumerable().OrderBy(taskSource => taskSource.AsString()),
    Counties = counties,
    Reports = null,
};

return this.View(homeIndexModel);


This homeIndexModel Is passed to the view when you visit the firstpage. As you can see, I assaign a Report-object to null.

I want to use thise Report-property of homeIndexModel when I do a search On the firstpage. When I hit "Search", a modal should appear and the search result printed out.

Here Is my search-method in the controller:
C#
[HttpPost]
        public ActionResult SearchReport(string searchVal, string searchParam)
        {
            var reports = m_errandSvc.GetReportSearch(searchVal, searchParam).ToList();
            var homeIndexModel = new HomeIndexModel()
            {
                Reports = reports
            };
            return this.View(homeIndexModel);
        } 


As you can see, I assaign the Report-property with the result of GetReportSearch. I want to loop through this object below:
C#
<!-- Modal -->
<div class="modal" id="myModalSearch" aria-hidden="true" data-keyboard="false" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4>FISH</h4>
                        @if (Model.Reports != null)
                        {

                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


The problem I have is that when I add a foreach, like this below, my debug-mode quits.
C#
@if (Model.Reports != null)
  {
     foreach(var itm in Model.Reports)
     {
         <div>@itm.Report_id</div>
         <div>@itm.ReportSource</div>
     }
  }


How can I solve this whole thing with homeIndexViewModel and print out my search-result as I want to?
AnswerRe: Pass ViewModel to view twice Pin
Nathan Minier25-Feb-16 1:53
professionalNathan Minier25-Feb-16 1:53 
QuestionGet file size from File Upload from IE and Chrome Pin
indian14324-Feb-16 15:49
indian14324-Feb-16 15:49 
AnswerRe: Get file size from File Upload from IE and Chrome Pin
F-ES Sitecore25-Feb-16 0:46
professionalF-ES Sitecore25-Feb-16 0:46 
QuestionSet the file upload value Pin
indian14324-Feb-16 11:24
indian14324-Feb-16 11:24 
AnswerRe: Set the file upload value Pin
Richard Deeming25-Feb-16 2:21
mveRichard Deeming25-Feb-16 2:21 
Questionfile upload, restricting size and type of files Pin
indian14324-Feb-16 7:43
indian14324-Feb-16 7:43 
AnswerRe: file upload, restricting size and type of files Pin
Richard Deeming24-Feb-16 7:56
mveRichard Deeming24-Feb-16 7:56 
GeneralRe: file upload, restricting size and type of files Pin
indian14324-Feb-16 12:54
indian14324-Feb-16 12:54 
AnswerRe: file upload, restricting size and type of files Pin
F-ES Sitecore25-Feb-16 0:43
professionalF-ES Sitecore25-Feb-16 0:43 
QuestionHow to filter data in DataTable using like operator ? Pin
Member 1228492023-Feb-16 19:04
Member 1228492023-Feb-16 19:04 
QuestionRe: How to filter data in DataTable using like operator ? Pin
Richard MacCutchan23-Feb-16 21:32
mveRichard MacCutchan23-Feb-16 21:32 
AnswerRe: How to filter data in DataTable using like operator ? Pin
aarif moh shaikh26-Feb-16 21:04
professionalaarif moh shaikh26-Feb-16 21:04 
Questionhow to bind Database field value in textbox based on choosing dropdownlist selected value in asp.net MVC Pin
Nithu Nithiya23-Feb-16 18:06
professionalNithu Nithiya23-Feb-16 18:06 
AnswerRe: how to bind Database field value in textbox based on choosing dropdownlist selected value in asp.net MVC Pin
John C Rayan27-Feb-16 21:39
professionalJohn C Rayan27-Feb-16 21:39 
QuestionDownload file from memorystream by client side click Pin
indian14323-Feb-16 13:33
indian14323-Feb-16 13:33 
AnswerRe: Download file from memorystream by client side click Pin
Richard MacCutchan23-Feb-16 21:29
mveRichard MacCutchan23-Feb-16 21:29 
GeneralRe: Download file from memorystream by client side click Pin
indian14324-Feb-16 7:21
indian14324-Feb-16 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.