Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i send a textbox value like e.g. "23" and click submit button then View page does not return "23+" I want to print concatinate value of Textbox Value and Button value on view page. help me pls.

My View Code Is as follows:

@using (Html.BeginForm("GetName", "Default1"))
{
@Html.TextBox("name",(string)ViewBag.test)
<input type="submit" value="+" name="Btn_plus"/>
}

My Controller Code is as Follows:

C#
public ActionResult GetName(string name, string Btn_plus)
       {
           ViewBag.test = name + Btn_plus;
           return View("Index");
       }
Posted
Updated 12-Dec-15 6:21am
v2

1 solution

Please try using the below....


@using (Html.BeginForm("GetName", "Home"))
{
@Html.TextBox("name",null, new { @Value = ViewBag.test})

}
 
Share this answer
 

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