Solved

dynamic URL string -- asp.net mvc4 ?

Posted on 2013-10-23
5
578 Views
Last Modified: 2013-10-24
Below Details.cshtml "123456" code works
How can I get below ""model.ID"" to work ?
---------------------------------------------------------------

                @Html.DisplayFor(model => model.ID)

                <img src="http://www.barcodesinc.com/generator/image.php?code=123456&style=197&type=C128B&width=200&height=50&xres=1&font=3">

                <img src="http://www.barcodesinc.com/generator/image.php?code= ""model.ID"" &style=197&type=C128B&width=200&height=50&xres=1&font=3">
0
Comment
Question by:finance_teacher
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39595163
Put an @ in front of it.

e.g.

<img src="http://www.barcodesinc.com/generator/image.php?code=@model.ID&style=197&type=C128B&width=200&height=50&xres=1&font=3">

Open in new window

0
 

Author Comment

by:finance_teacher
ID: 39595241
That fails, so I tried the below which also fails
How can I fix ?

                <img src="http://www.barcodesinc.com/generator/image.php?code= + @model.BillingDate + &style=197&type=C128B&width=200&height=50&xres=1&font=3">
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39596275
Sorry, the "model" needs to be capitalized:

<img src="http://www.barcodesinc.com/generator/image.php?code=@Model.ID&style=197&type=C128B&width=200&height=50&xres=1&font=3">

Open in new window


Little "m" is something different.
0
 

Author Comment

by:finance_teacher
ID: 39596896
How can I have it be TWO values ?
---------------------------------------------------------------------------------------------------------------------
Below works, showing both values.
                <img src="http://www.barcodesinc.com/generator/image.php?code=@Model.ID@Model.IFSWO&style=197&type=C128B&width=200&height=50&xres=1&font=3">
---------------------------------------------------------------------------------------------------------------------
Below fails, trying to add a space between the values.
                <img src="http://www.barcodesinc.com/generator/image.php?code=@Model.ID" "@Model.IFSWO&style=197&type=C128B&width=200&height=50&xres=1&font=3">
0
 

Author Comment

by:finance_teacher
ID: 39596899
Below works by just putting a space, no " " needed.

                <img src="http://www.barcodesinc.com/generator/image.php?code=@Model.ID @Model.IFSWO&style=197&type=C128B&width=200&height=50&xres=1&font=3">
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
reading excel file in .net 2 30
itextsharp with c# 3 18
Need help with another query 10 34
Set the FileVersion of a website dll 1 20
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question