asp.net - Partial view for container -


say, i'm using following html in asp.net mvc application:

<div class="a">   <div class="b">      (varying content)   </div> </div> 

i'd put repeating div part separate file , reuse (notice, content may, , change). how can that?

keep in partialview, eg: _commondiv

call partial view view

@html.partial("_commondiv", null, new viewdatadictionary {{ "yourvaringcontentkey", yourcontent}}) 

get content in partialview

string yourcontent= (string)this.viewdata["yourvaringcontentkey"]; 

and use same want.


Comments