Previously, I was passing information to a Silverlight control inside of the Page_Load method. i.e.
protected void Page_Load(object sender, EventArgs e)
{
MainContainer.InitParameters = "info=" + CurrentUserID.ToString();
}
In MVC, without the concept of a code-behind, I've passed the user ID as part of the model, but the following code doesn't seem to be working:
<asp:Silverlight id="MainContainer"
InitParameters="info=<%= Model.CurrentUserID %>" runat="server"
Source="~/ClientBin/SilverlightControls.xap" ... />
If you look at the code that gets rendered to the browser, it is escaping the MVC tags, so it gets sent like this:
value="info=<%= Model.CurrentUserID %>"
If I try hardcoding InitParameters="info=1", it works.