asp.net mvc - pass data from controller to view -


i know there many ways it. want pass cerq text view. want see cerq in div. not want see div tags instead want browser interpret it.

this function in controller

    public actionresult index()     {           viewdata["cerq"] = "<div>baha</div>";           return view();     } 

and view part

@{     viewbag.title = "abc";     layout = "~/views/common/_layout.cshtml"; }  <h2>menudene  - @viewdata["cerq"] - </h2> 

what should do?

in view wrote

@html.raw(viewdata["cerq"]) 

and solves.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -