c# - See what List type is posted from Controller to View -


i'm showing table in view, data post controller list type of list<mytransaction>. works don't have check kind of list sent, can use , manipulate data in view want.

thing is, have fix bug , have to, in cases, send list type of list<mytransaction2>. when this, want format table in view in different way, different data coming in.

i've been looking solution while can't find fits needs. there way, using jquery, determine list type sent view? have tried solutions try identify kind of list identifiers in data, it's not consistent solution , prone bugs -- tests didn't agree solution @ all...

why don't use viewbag or viewdata determine it. can set types in viewbag like

viewbag.type = "type1" or

viewbag.type = "type2" 

and on cshtml

@if(viewbag.type = "type1") {     //type 1 job } else if(viewbag.type = "type2") {     //type 2 job } 

thanks


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -