Click here to Skip to main content
15,921,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am completely new to asp.net mvc. I have basic knowledge of how mvc works.
I have a logout panel in my view and i want to add the literal control inside it.I have tried in aspx and aspx.cs.
I have no idea how to do it in mvc.
aspx.cs

this.LogoutPanel.Controls.Add(new LiteralControl(String.Format("

 <img width='1px' src='{0}?wa=wsignoutcleanup1.0' " + "title='Signout request: {0}?wa=wsignoutcleanup1.0'/>

", signedInUrl)));

Can someone help me out.

What I have tried:

I have no idea on how to do this in mvc controllers and view.

aspx.cs

this.LogoutPanel.Controls.Add(new LiteralControl(String.Format("

 <img width='1px' src='{0}?wa=wsignoutcleanup1.0' " + "title='Signout request: {0}?wa=wsignoutcleanup1.0'/>

", signedInUrl)));
Posted
Updated 22-May-16 22:29pm

1 solution

You just put the img tag in the view and put the desired url in the model you pass to the view (or the ViewBag but model is better)

HTML
<img src="@Model.LogoutUrl"/>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900