i have
@Html.ActionLink("Remove 1034, 1035, 1036", "RemoveSelected")
Now i want to set each id from Controller
for example:
@Html.ActionLink(ViewBag.RemoveSelectedTitle, "RemoveSelected") //this is not work
// GET: /TabMaster/
public ActionResult Index()
{
ViewBag.RemoveSelectedTitle = "100,101,102";
return View(_tabmasterService.GetTabMasterList(10, 1));
}
You need to cast the RemoveSelectedTitle as a string. As your using the Viewbag this is a dynamic object and doesn't know the RemoveSelectedTitle is a string. You ActionLink should be something like:
@Html.ActionLink((string)ViewBag.RemoveSelectedTitle, "RemoveSelected")
I was trying to concatenate some hard coded text, and an int from the ViewBag, and found that this syntax worked:
@Html.ActionLink((string)("Remove Selected - # " + ViewBag.RemoveSelectedNumber.ToString()), "RemoveSelected")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With