solution1368
asked on
mvc, razor
In controller:
public ActionResult Index()
{
string inputState = Request.QueryString["input State"];
string inputBond = Request.QueryString["input Bond"];
string userControlID = ServSuretyNetworkRef.GetBo ndUserCont rol(inputS tate, 1, inputBond);
ViewBag.Message = userControlID;
return View();
}
View:
This one below does not work, and need help why and how to fix it? Thanks
@Html.Partial(@ViewBag.Mes sage)
However, the following is working
@Html.Partial("./ControlsA dditionalB ondInfo/De fectiveTit le.cshtml" )
public ActionResult Index()
{
string inputState = Request.QueryString["input
string inputBond = Request.QueryString["input
string userControlID = ServSuretyNetworkRef.GetBo
ViewBag.Message = userControlID;
return View();
}
View:
This one below does not work, and need help why and how to fix it? Thanks
@Html.Partial(@ViewBag.Mes
However, the following is working
@Html.Partial("./ControlsA
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
actually, i did test it and @Html.Partial((string)View Bag.Messag e) solution is working to me.
adding (string) in the front of viewbag does resolve the string issue.
Thank you for your helps.
adding (string) in the front of viewbag does resolve the string issue.
Thank you for your helps.
ASKER
Good lesson to learn for mvc viewbag.message. When a string parameter is passed from the controller to razor engine. Adding (string) will be resolved the debug issue.
Thank you for expert helping.
Thank you for expert helping.
ASKER
And my question is why it is working with the static string n not work in viewbag