My new MVC3 web application allows users to store some information about themselves, and we want to be able to display this information in a QR code (to other users, or for the user to copy and make it their own.) At this stage, we just want to have the QR Code point back to the user's profile page on our site. The Google API seems like a good fit for this, and after looking around I was able to put some simple data into an IMG to display on the page.
Something like this:
<div class="display-label">QRCode</div>
<div class="display-field">
@Html.DisplayFor(model => model.QRCode)
<img src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=" alt="Your QR Code" />
</div>
So far, all is well & good. However, the dynamic part of the issue is that we are storing the user's profile URL in the "QRCode" field (for just these purposes.) I have been trying, and failing, to introduce the value in model.QRcode (i.e., the URL) into becoming part of the IMG src value.
So, if the value in model.QRCode was (for example): http://mysite.com/profiles/UserId=101 then I would want to build the page so that the IMG was this:
<img src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=http://mysite.com/profiles/UserId=101" alt="Your QR Code" />
I have tried HTML Encoding, various brackets, and lots of looking around for help, but am not sure how to build this piece of an IMG src dynamically. Anyone have any good ideas?