0

I am passing a variable to my Index.cshtml

<td>@Model.DIN</td>

DIN is coming from database as

<A HREF="http://local/reports/rwservlet?imgu12g&Din=123456" target=new>123456</A>

I am suposed to get a hyperlinked 123456 to the image but I get the actual string that in DIN. if I do

<td><A HREF="http://local/reports/rwservlet?imgu12g&Din=123456" target=new>123456</A></td>

it works fine. Any suggestions.Thank you!

4
  • Try <td><a href="http://local/reports/rwservlet?imgu12g&Din=<%= Model.DIN %>" target=new>My Link</a></td>, although I might have gotten that URL a little skewed. The idea is to insert it into the a tag Commented Jun 10, 2016 at 17:37
  • Actually DIN is this entire string: <A HREF="http://local/reports/rwservlet?imgu12g&Din=123456" target=new>123456</A> Commented Jun 10, 2016 at 17:43
  • Oh, gotcha. Where are you getting that string from, the database? Or are you building it server-side? Commented Jun 10, 2016 at 18:55
  • Can you modify the database? It sounds like your data in the database is not correct. You shouldn't be storing the whole link string in the database, just the relevant DIN. Commented Jun 12, 2016 at 16:20

1 Answer 1

1

I thing that in Razor you can do this

<td><A HREF="http://local/reports/rwservlet?imgu12g&[email protected]" target=new>@Model.DIN</A></td>

Try it. may be it's what you are looking for !

If the data you are getting from database is in HTML format and you want to display it. you can do this:

<tr>@Html.Raw(Model.DIN)</tr>

This will display your html string in the web page.

Sign up to request clarification or add additional context in comments.

1 Comment

<tr>@Html.Raw(Model.DIN)</tr> works like champ! Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.