Dynamic parameter passing

I want to pass a dynamic parameter (UserName) from a web application to silverlight. I know how I can do this in Silverlight 2.0 with the Asp: Silverlight tag, however, as in Silverlight 3.0, instead of the Object tag instead of the Asp: Silverlight tag, I was wondering how to pass the dynamic parameter to Silverlight 3.0? I know that we can use init param, however in initparam we can just send a static parameter. In the init parameter, you can send the parameter value and static value. I need to send a dynamic parameter.

Please help, thank you

+4
source share
4 answers

You can dynamically create a SL object control and have a parameter in it. If necessary, you can also interact with your management using JavaScript. I assume that the dynamic parameter you are talking about is some value from the HTML on the page. If the value changes with active SL management, you will need to use JavaScript to pump the changes to your SL control. If you get data from the code behind, you can use <% = SomeProperty%> in the initparms parameter. When using this method, ASP.Net will deflate the value when rendering the page, and then the browser will see it as a static value, but it will be dynamically generated.

Hope this helps.

+3
source

You can use the InitParams of the Object tag to pass some information to the Silverlight application and access it in the StartupEventArgs Start Event.

+1
source

You can reuse the Silverlight control if you have not deleted the assembly containing it. It should still work.

Also, on the aspx host page, add runat="server" and id to the <params ...> :

 <params runat="server" id="initParams" name="initParams" /> 

In the code located in the Page_Load(...) method, you can:

 this.initParams = "myKey1=something,myKey2=whatever..."; 
+1
source

On the Sliverlight hosting page, add runat = "Server" and the ID as "initParams" to your tag in the Sliverlight object tag.

In your Page_Load () method. you can assign your dynamic initParams values ​​as below

initParams.Attributes.Add ("Value", "PageId = 3");

0
source

Source: https://habr.com/ru/post/1299904/


All Articles