question

MiguelBT-9804 avatar image
0 Votes"
MiguelBT-9804 asked YijingSun-MSFT commented

How can I force a value to be displayed outside my model?

So it doesn't seem so complex, I'll give you a simple example of what I want:


 string statusString = status 2;
 return View(myData.where(x => x.status == statusString)


in sight it will be something of this kind:

 @foreach (var item in Model)
  {
        @item.myData.status
  }

The code above will display everything that is in status2 in myData, right

but it turns out I need values that are in another position or outside of the preview model.

is it possible to continue to view everything equal to status2 and force a value outside the model type =status1 to be displayed?

what I tried

 @item.myData.Where(x => x.status == "status1" )  

Thanks,






dotnet-aspnet-mvc
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MiguelBT-9804 ,

but it turns out I need values that are in another position or outside of the preview model.

I don't understand your requirement about outside of the preview model. What this means?
I'm guessing that you have a list in the models. And you want to select where the status is status1 using linq.
Best regards,
Yijing Sun
0 Votes 0 ·

1 Answer

DuaneArnold-0443 avatar image
0 Votes"
DuaneArnold-0443 answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.