Click here to Skip to main content
15,882,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi my LogIn is partial view. i pass a model that contain some fields of tbl_profile to partial view and fill it and then i pass filled model to a action result in [HttpPost] part and ... but now i'm trouble in [HttpGet] part . i get this error on this line of cod:
@{ Html.RenderPartial("LogOn", "Account"); }

<pre lang="c#">

    public ActionResult LogOn(string returnUrl)

         using (var db = new MyContext())

           var  AllFeatureToLog = db.tbl_profile.Select(u => new UsersClass.LogOn { username = u.username, password_User = u.password_User });

            return PartialView(AllFeatureToLog);

class :
public class UsersClass
   public class LogOn
       public string username { get; set; }
       public string password_User { get; set; }

partial view(logon.cshtml):

  @model MyProject.Models.UsersClass.LogOn     
    @using (Html.BeginForm())
   <form class="signin-form">

     @Html.TextBoxFor(m => m.username, new { @id = "username", @class = "input-block-       level", @placeholder = "* enter username" })
     @Html.TextBoxFor(m => m.password_User, new { @id = "password", @class = "input-block-level", @placeholder = "* enter pass" })

<label class="checkbox">
    <input type="checkbox">remember me</label>
<button class="btn btn-medium btn-general input-block-level" type="submit">   enter</button>

error :

The model item passed into the dictionary is of type 'System.String', but this dictionary requires a model item of type 'MyProject.Models.UsersClass+LogOn'

when i use breakpoint on controller ([HttpGet]) it dose not go into it .and directly shows this error .
Updated 15-Aug-13 23:04pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900