Click here to Skip to main content
15,886,919 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Pls help getting error..The name 'ObjectFactory' does not exist in the current context Pin
John C Rayan21-Apr-16 0:32
professionalJohn C Rayan21-Apr-16 0:32 
QuestionFreezing Heading of one DataGrid with data from different datasets Pin
Member 1247018419-Apr-16 20:34
Member 1247018419-Apr-16 20:34 
QuestionHow to use HandleUnknownAction Pin
nasirs516-Apr-16 23:13
nasirs516-Apr-16 23:13 
AnswerRe: How to use HandleUnknownAction Pin
John C Rayan17-Apr-16 23:24
professionalJohn C Rayan17-Apr-16 23:24 
QuestionMVC asp.net 4.0 "using templates" Pin
Member 1241562115-Apr-16 1:52
Member 1241562115-Apr-16 1:52 
AnswerRe: MVC asp.net 4.0 "using templates" Pin
John C Rayan15-Apr-16 2:00
professionalJohn C Rayan15-Apr-16 2:00 
AnswerRe: MVC asp.net 4.0 "using templates" Pin
John C Rayan15-Jun-16 1:28
professionalJohn C Rayan15-Jun-16 1:28 
Questionworking in MVC4 ..Getting Error pls help Pin
sunil314-Apr-16 19:35
sunil314-Apr-16 19:35 
when I'm trying any one of these Getting Error ..pls help

public ActionResult Index()
{
/* Mapper.CreateMap();
var dbContext = new WorkTraningEntities();
var emplist = from employee in dbContext.Employees select employee;
var emps = new List();
if (emplist.Any())
{
foreach (var employee in emplist)
{
EmpEntity empModel = Mapper.Map(employee);
emps.Add(empModel);
    }
}
return View(emps);*/
var config = new MapperConfiguration(cfg => cfg.CreateMap<Employee,EmpEntity>());

IMapper mapper = config.CreateMapper();
var source = new Employee();
var dest = mapper.Map<Employee,EmpEntity>(source);

Mapper.AssertConfigurationIsValid();
return View(source);

}

Error is :

The model item passed into the dictionary is of type 'MvcAutoMapperDemo.Employee', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[MvcAutoMapperDemo.Employee]'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The model item passed into the dictionary is of type 'MvcAutoMapperDemo.Employee', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[MvcAutoMapperDemo.Employee]'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: The model item passed into the dictionary is of type 'MvcAutoMapperDemo.Employee', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable1[MvcAutoMapperDemo.Employee]'.]
System.Web.Mvc.ViewDataDictionary1.SetModel(Object value) +608383
System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary) +371
System.Web.Mvc.WebViewPage1.SetViewData(ViewDataDictionary viewData) +50
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +98
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +294
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +15
System.Web.Mvc.<>c__DisplayClass1a.<invokeactionresultwithfilters>b__17() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +242
System.Web.Mvc.<>c__DisplayClass1c.b__19() +25
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +175
System.Web.Mvc.Async.<>c__DisplayClass2a.<begininvokeaction>b__20() +89
System.Web.Mvc.Async.<>c__DisplayClass25.<begininvokeaction>b__22(IAsyncResult asyncResult) +102
System.Web.Mvc.Async.WrappedAsyncResult1.End() +58
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +44
System.Web.Mvc.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult) +15
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +16
System.Web.Mvc.Async.WrappedAsyncResult1.End() +58
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +54
System.Web.Mvc.Async.<>c__DisplayClass4.<makevoiddelegate>b__3(IAsyncResult ar) +16
System.Web.Mvc.Async.WrappedAsyncResult1.End() +58
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +44
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +12
System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +16
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +58
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +11
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9734909
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1532.0
AnswerRe: working in MVC4 ..Getting Error pls help Pin
F-ES Sitecore15-Apr-16 0:22
professionalF-ES Sitecore15-Apr-16 0:22 
AnswerRe: working in MVC4 ..Getting Error pls help Pin
John C Rayan15-Apr-16 0:24
professionalJohn C Rayan15-Apr-16 0:24 
Questionpartial views connection of index view Pin
Member 1243381313-Apr-16 21:34
Member 1243381313-Apr-16 21:34 
RantREPOST Pin
Richard Deeming14-Apr-16 1:53
mveRichard Deeming14-Apr-16 1:53 
AnswerRe: partial views connection of index view Pin
F-ES Sitecore14-Apr-16 1:57
professionalF-ES Sitecore14-Apr-16 1:57 
Questiontext Pin
Member 1205765613-Apr-16 19:28
Member 1205765613-Apr-16 19:28 
AnswerRe: text Pin
Richard MacCutchan13-Apr-16 20:47
mveRichard MacCutchan13-Apr-16 20:47 
AnswerRe: text Pin
aarif moh shaikh14-Apr-16 18:43
professionalaarif moh shaikh14-Apr-16 18:43 
QuestionAbout AutoMapper In Asp.net MVC4 Pin
sunil312-Apr-16 20:48
sunil312-Apr-16 20:48 
AnswerRe: About AutoMapper In Asp.net MVC4 Pin
Richard MacCutchan12-Apr-16 21:33
mveRichard MacCutchan12-Apr-16 21:33 
GeneralRe: About AutoMapper In Asp.net MVC4 Pin
sunil312-Apr-16 23:38
sunil312-Apr-16 23:38 
GeneralRe: About AutoMapper In Asp.net MVC4 Pin
Richard MacCutchan13-Apr-16 0:38
mveRichard MacCutchan13-Apr-16 0:38 
QuestionC#.net Pin
Member 1244937511-Apr-16 20:43
Member 1244937511-Apr-16 20:43 
QuestionRe: C#.net Pin
Richard MacCutchan11-Apr-16 21:32
mveRichard MacCutchan11-Apr-16 21:32 
QuestionRe: C#.net Pin
koolprasad200311-Apr-16 22:52
professionalkoolprasad200311-Apr-16 22:52 
AnswerRe: C#.net Pin
Nathan Minier13-Apr-16 4:01
professionalNathan Minier13-Apr-16 4:01 
QuestionView AutoCad Files in asp.net mvc Pin
Member 1244510911-Apr-16 0:52
Member 1244510911-Apr-16 0:52 

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.