I have two action result one sending a string and another loading the view
public ActionResult getTheString()
{
string message = //doing some thing ;
myModel myModel = new myModel();
myModel.property1 = message ;
return loadView(myModel);
}
public ActionResult loadView(myModel model)
{
return view (model);
}
loadView.cshtml
@model project.Models.myModel
@{
if(Model.property1 !=" ")
{what to do to show it as alert }
}
Here I am getting the prperty like model.property1 if it has some thing show the alert with that string and then load, if message does not contain anything then simply load.
Not permitted to use TempData , ViewBag , ViewData.
Not permitted to use Script tag in view . it has to be in a seperate js file