Click here to Skip to main content
15,893,190 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Action Method is Not Passing Value

ControllerIS

SQL
public ActionResult UserName()
       {
           return View();
       }

       [AcceptVerbs(HttpVerbs.Post)]
       public ActionResult UserName(string B1, string T1)
       {
           ViewData["a"] = "User Name is :-" + T1; ;
           return View();

       }



Source Code : View is


@{
ViewBag.Title = "UserName";
}

UserName



@using (Html.BeginForm())
{

Registeration



@Html.Label("Enter Your Name") @Html.TextBox("T1")
<button id="B1" type="submit">Submit</button>



}
Posted

I think you are trying scaffolding. Try form collection or jquery Ajax Post
 
Share this answer
 
C#
public class User
{
public string username{get;set:}
public string password {get;set}

}
-- model


--View

HTML
@model yourproject.Models.User

@Html.TextBoxFor(m => m.username);
@Html.TextBoxFor(m => m.password );



--controller

SQL
public ActionResult UserName(User obj)
      {
          ViewData["a"] = "User Name is :-" + obj.username; ;
          return View();

      }
 
Share this answer
 
Comments
Sai Prasad anumolu 18-Aug-14 0:01am    
I used button Logic sir .......

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



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