title: Cannot bind source type Umbraco.Web.Models.RenderModel to model type Repower.Cms.Umbraco.Models.Test
body: <p>First of all I am new to Umbraco so if you see some basic mistakes don't judge me.</p>
  
  <p>So I am creating currently a Login form which he goes to the database (check Username and Password) and reads the value which he returns and let's him <code>Cannot bind source type Umbraco.Web.Models.RenderModel to model type Repower.Cms.Umbraco.Models.Test.</code></p>
  
  <p>This Is my HTML:</p>
  
  <pre><code>    @inherits Umbraco.Web.Mvc.UmbracoViewPage&lt;Repower.Cms.Umbraco.Models.Test&gt;
  
  @{
      Layout = "Master.cshtml";
  }
  
  &lt;style type="text/css"&gt;
      .btnStyle {
          border: thin solid #000000;
          line-height: normal;
          width: 80px;
      }
  &lt;/style&gt;
  @using (Html.BeginForm("Test", "MembersProtectedPage", FormMethod.Post))
  {
      &lt;div class="fontStyle"&gt;
          &lt;center&gt;
              &lt;table style="margin-top: 100px;margin-left:150px"&gt;
                  &lt;tr style="height:30px"&gt;
                      &lt;td align="right"&gt;
                          @Html.LabelFor(m =&gt; m.User)
                      &lt;/td&gt;
                      &lt;td style="width:200px" align="right"&gt;
                          @Html.TextBoxFor(m =&gt; m.User)
                      &lt;/td&gt;
                      &lt;td style="width:250px;color:Red" align="left"&gt;
                          @Html.ValidationMessageFor(m =&gt; m.User)
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr style="height:30px"&gt;
                      &lt;td align="right"&gt;
                          @Html.LabelFor(m =&gt; m.Password)
                      &lt;/td&gt;
                      &lt;td align="right"&gt;
                          @Html.PasswordFor(m =&gt; m.Password)
                      &lt;/td&gt;
                      &lt;td style="width:250px;color:Red" align="left"&gt;
                          @Html.ValidationMessageFor(m =&gt; m.Password)
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr style="height:30px"&gt;
                      &lt;td colspan="2" align="center"&gt;
                          &lt;input type="submit" value="Sign In" class="btnStyle" /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/center&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>This is my Model:</p>
  
  <pre><code>    public class Test : RenderModel
  {
      public Test() : this(new UmbracoHelper(UmbracoContext.Current).TypedContent(UmbracoContext.Current.PageId)) { }
      public Test(IPublishedContent content, CultureInfo culture) : base(content, culture) { }
      public Test(IPublishedContent content) : base(content) { }
  
      string connString = ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString;
      SqlConnection conn;
      SqlCommand sqlcomm;
  
      public string User { get; set; }
      public string Password { get; set; }
  
      public bool IsUserExist(string emailid, string password)
      {
          bool flag = false;
          conn = new SqlConnection(connString);
          conn.Open();
  
          sqlcomm = new SqlCommand();
          sqlcomm.Connection = conn;
          sqlcomm.CommandType = System.Data.CommandType.StoredProcedure;
          sqlcomm.CommandText = "dbo.uspLogin";
          sqlcomm.Parameters.AddWithValue("@pLoginName", User);
          sqlcomm.Parameters.AddWithValue("@pPassword", Password);
  
          SqlParameter retval = sqlcomm.Parameters.Add("@RESULT", SqlDbType.VarChar);
          retval.Direction = ParameterDirection.ReturnValue;
          sqlcomm.ExecuteNonQuery(); // MISSING
          string retunvalue = (string)sqlcomm.Parameters["@RESULT"].Value;
  
          switch (retunvalue)
          {
              case "0":
                  flag = true;
                  break;
              case "1":
                  flag = false;
                  break;
              case "2":
                  flag = false;
                  break;
              default:
                  flag = false;
                  break;
          }
          return flag;
      }
  }
  </code></pre>
  
  <p>And this is my Controller: </p>
  
  <pre><code>public class TestController : Controller
  {
      public ViewResult Login()
      {
          return View();
      }
  
  [HttpPost, ValidateInput(false)]
  public ActionResult Login(Test model)
  {
      if (ModelState.IsValid)
      {
          if (model.IsUserExist(model.User, model.Password))
          {
              ViewBag.UserName = model.User;
              FormsAuthentication.RedirectFromLoginPage(model.User, false);
          }
          else
          {
              ModelState.AddModelError("", "Username or Password Incorrect.");
          }
      }
      return View(model);
     }
  }
  </code></pre>
  
  <p>So I am inheriting a RenderModel because previously my error was "The model item passed into the dictionary is of type Repower.Cms.Umbraco.Models.Test', but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel'."
  So I changed it (searched a lot in the Internet) and now I get this error.</p>
  
  <p>Is also the rest of the code correct? The way that I access the Database and everything? I am expecting a Return value from the Database (don't know if that is correct)</p>
  
  <p>Could Someone please help me?
  I need to get this done today.</p>
  
  <p>Thanks in Advance</p>