Jack Jack - 1 year ago 58
HTML Question

how to concatenate an int parameter in an href in a MVC view

I have the following

in a

<span style="min-width: 105px; max-width: 120px; display: inline-block;">Images Available:</span>

In the second
I would like to add an reference to an
page that requires an
d passed to in (which is an int data type)

I thought of doing something like this:

<span><b><a href="~/pages/inventory/_inventory_image.aspx?qinventory_id=" + Model.InventoryId</a></b></span>

That half works by giving me the page url but no InventoryId.

I also tried ampersand (which I know is for string values) also to no avail

Could someone help a brother out? :-)

Answer Source

You need to pass Model.InventoryId with the quotes.

<span><b><a href="~/pages/inventory/_inventory_image.aspx?qinventory_id=@Model.InventoryId"></a></b></span>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download