Concat价值不是mvc [英] Concat Value not is coming in mvc

查看:64
本文介绍了Concat价值不是mvc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我发送文本框值时,例如23并单击提交按钮,然后查看页面不返回23+我想在视图页面上打印文本框值和按钮值的concatinate值。帮助我。



我的查看代码如下:



@using(Html.BeginForm( GetName,Default1))

{

@ Html.TextBox(name,(string)ViewBag.test)

< input type =submitvalue =+name =Btn_plus/>

}



我的控制器代码是如下:



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:

public ActionResult GetName(string name, string Btn_plus)
       {
           ViewBag.test = name + Btn_plus;
           return View("Index");
       }

推荐答案

请尝试使用以下.... < br $> b $ b



@using(Html.BeginForm(GetName,Home))

{

@ Html.TextBox(name,null,new {@Value = ViewBag.test})



}
Please try using the below....


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

}


这篇关于Concat价值不是mvc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆