Skip to content
Loading
  • @Html.Label("Password")
    @Html.TextBox("txtPassword") : pass
    }
    2.Controller class Login action method code (WelcomeController)
    public ActionResult Login()
    {
    return View();
    }
    [HttpPost]
    public ActionResult Login()
    {
    string userName = Request.Form["txtUserName"];
    string password = Request.Form["txtPassword"];
    }
    OR you can also try for below.
    [HttpPost]
    public ActionResult Login(FormCollection collection)
    {
    string userName = collection["txtUserName"];
    string password = collection["txtPassword"];
    }
    Please Note this: this code is only for understanding purpose. It might be have error. hope you understood.
    0
  • Blumonde
    0
    Harish, thank you for the advice but that wasn't my goal. If you read the link I provided in my original post, I am trying to do the same thing the Author of the tutorial by retrieving the coordinates of a persistent panel from the database which is below:
    1. foreach (DataRow row in dt.Rows)  
    2. {  
    3. HtmlControl ctl = (HtmlControl)this.FindControl(row["element"].ToString());  
    4. if (ctl != null)  
    5. {  
    6. ctl.Style.Add("left", row["xPos"].ToString() + "px");   ctl.Style.Add("top", row["yPos"].ToString() + "px");  
    7. }  
    8. }  
    The problem is that the code above was written for web form and I don't know how to convert it so that it would work in Mvc controller action.
     
    Hope that explains it.
    0