Ashkan Mobayen Khiabani Ashkan Mobayen Khiabani - 4 days ago 5
ASP.NET (C#) Question

Get Model name in a partial view

Is there any way to get the name of current model in a partial view?

I want to do something like:

@if(Model.Name=="Something"){
....
}
else{
...
}

Answer

you can use try something like

@model.GetType().Name 
Comments