I have written a Silverlight 4 app. I tried to load initParams to pass to the out-of-browser app. Page_Load is never run.
My aspx file includes the following:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PackageInTestPage.aspx.cs" Inherits="PackageIn.Web.PackageInTestPage" %>
…
<body>
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
…
<param name="initParams" value="<% =WebDotConfig%>" /></div>
My codebehind file,
PackageInTestPage.aspx.cs
looks like this:
namespace PackageIn.Web
{
public partial class PackageInTestPage : System.Web.UI.Page
{
public string WebDotConfig { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
WebDotConfig = ""
<code to="" fill="" in="" webdotconfig="">
...
</code>
I also tried adding the following code to the .aspx file with no luck:
<script type="text/C#" language="c#" >
public string WebDotConfig { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
WebDotConfig = "PackageWeight1=" + ConfigurationManager.AppSettings["PackageWeight1"];
WebDotConfig += ",TicketCount1=" + ConfigurationManager.AppSettings["TicketCount1"];
WebDotConfig += ",MaxTicketsPerPackage=" + ConfigurationManager.AppSettings["MaxTicketsPerPackage"];
}
The app will run but the initParams is always blank.
I tried inserting
"throw new exception("xxx");"
into the first line of
Page_Load
and it made no difference so I don't think the
Page_Load
was run. In the debugger, the breakpoint displays with the "!" saying the breakpoint will never be reached.
It is the same whether I run out-of-browser or not. If I set my
PackageIn.Web
project as the start up project, THEN the
Page_Load
will run.
I have tried a few variations in the codebehind= and inherits= values but that has not helped.
I have read multiple posts describing how to set
initParams
in Silverlight and I think I am following all the instructions.
If anyone can tell me what I am doing wrong or how to track down the problem, I would really appreciate it.