我希望我的按钮标签上有文字

时间:2014-08-05 06:50:25

标签: asp.net-mvc-4 button tags

下面是我的按钮的代码

<button type="button"  Value="End Test" class="testBtns" style="float:right;"onclick="location.href='@Url.Action("StudentResult", "Student", new {  TestId = ViewBag.TestId ,style="color:white"} )'" />

i am not getting the "End Text" text on my button anybody know then please help

2 个答案:

答案 0 :(得分:1)

试试这个;

<button type="button"  class="testBtns" style="float:right;" onclick="location.href='@Url.Action("StudentResult", "Student", new {  TestId = ViewBag.TestId ,style="color:white"} )'" >End Test</button>

value属性指定<button><form>的初始值,而不是显示文字。

答案 1 :(得分:1)

只需将按钮更正为:

<button type="button"  class="testBtns" style="float:right;" onclick="location.href='@Url.Action("StudentResult", "Student", new {  TestId = ViewBag.TestId },new { @style="color:white" } )'">End Test</button>

要在按钮中显示的文字应该包含在button tag的开始和结束标记之间,只需更正@url.action即可 object routehtml attributes