0

Afternoon SO.

I am currently scratching my head over an issue regarding the passing of parameters into my MVC view.

Scenario: I have the Razor/HTML view. It contains an img control. When I navigate to the page, without a parameter, the image renders... when I navigate and include a further '/parameter' - it does not render. I must be doing something incredibly stupid - but what?

View

@{
    ViewBag.Title = "Tender";
}

@using JobList.Models.Pages
@model TenderPage

    <h3 style="margin-top:5px;">New Tender</h3>
    <p style="margin-top:-12px;"><b>Required fields are marked with an asterix (*)</b></p>
    <div style="float:left; margin:-10px 8px 8px 0px; height:30px;">
        <img id="unlockImg" src="../Content/Images/Shared/lock32.png" alt="Unlock" title="Unlock" style="visibility:collapse; position:absolute;" />
        <img id="saveImg" src="../Content/Images/Shared/disk32.png" alt="Update" title="Update" style="visibility:visible; position:absolute;" />
    </div>

Controller (Simplified):

public ActionResult Tender(Int32? ID = null)
{
  return View(GenerateTender(ID));
}

private TenderPage GenerateTender(Int32? ID)
{
  TenderPage page = new TenderPage();

  using (EnquiriesWorkUnit workUnit = EnquiriesWorkUnit.Begin())
  {
    page.Tender = new Tender();

    if (ID.HasValue && ID.Value > 0)
    {
      //SOMETHING
    }
  }

return page;
}

Without Parameter

With Parameter

1 Answer 1

1

Yes. I am being a numpty. Adding the parameter the way I was is altering the relative-path for the image source.

Fixed by removing the '..' (relative pathing) on the source-path.

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

Comments

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.