c# - How to set a name to the TITLE of a newly opened tab from the @Html.ActionLink cshtml page -
my current code in index.cshtml
page:
@html.actionlinks(@html.actionlink(objlist.name, "name", "controllername", new {id=objlist.id}, new {target = "_blank"}))
the above code makes me open page(name.cshtml
) in new tab after clicking link in index
page. goal assign name(objlist.name
) title
new tab. so, added title attribute in following code not working expected.
@html.actionlinks(@html.actionlink(objlist.name, "name", "controllername", new {id=objlist.id}, new {target = "_blank", title = objlist.name}))
how acheive this?
you have pass objlist.name parameter "name" action, in action can include name in viewbag:
viewbag.mytitle = nameparameter;
and in "name" view:
<title>@viewbag.mytitle</title>
if using layout page, have put in "name" action:
viewbag.title = nameparameter;
because in layout view have this:
<title>@viewbag.title</title>
Comments
Post a Comment