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
Post a Comment