In your view you can do something like this:
// if this is true then there's nothing there
@if (ViewBag.Query == null)
further you can do this:
// it was set by the "Order" case
@if (ViewBag.Query is List<Ordr>)
Question
Is there any way to check viewbag content, what the viewbag has of data in the view. my controller send possibly new data each time i click on button and send it with the same named viewbag.
here my controller
public ActionResult Details(string IncomRequest, Int Id)
{
// some code......
switch (IncomRequest)
{
case ("Order"):
ViewBag.Query = list<Ordr> Ord;
break;
case ("Process"):
ViewBag.Query = lis<Process> pro;
break;
}
return view();
in my view i want to check what the viewbag contains is it Ord or pro.
Solution
In your view you can do something like this:
// if this is true then there's nothing there
@if (ViewBag.Query == null)
further you can do this:
// it was set by the "Order" case
@if (ViewBag.Query is List<Ordr>)
OTHER TIPS
Yes you can
@if(ViewBag.Query is List<Ordr>)
{
// List<Ordr>
}
else if(ViewBag.Query is List<Process>)
{
// List<Process>
}