This is a mirror of official site: http://jasper-net.blogspot.com/

How to pass values to Silverlight application from ASPX page using InitParameter ?

| Sunday, July 25, 2010
Neither the Silverlight is new nor the init params. But, I found various people in different forums asking for the logic on the implementation part for passing value to Silverlight application from ASP.Net application. In this post, I will describe about it.

Here I will discuss on the InitParams and tell you how to use it to pass value from your .aspx page to your Silverlight application. Read the complete post and if you have any queries, don’t hesitate to ask me.

InitParams is one of the param name of the Silverlight plug-in object. Generally it is a dictionary object of type string. It contains a set of user defined key/value pairs. By default it is set as null or empty string and initializes at the time of first instance. Later it becomes readonly and hence you will not be able to modify it. If you have more than one string values to pass, use comma separated key/value pairs. Have a look into it:

<param name="initparams" value="a=10,b=20" />

Here, I am passing 10 & 20 as two string value to the key names a & b respectively. Now you can retrieve the value in backend code by using the Key a & Key b. I will discuss it later part.

Let us discuss about it in more depth. Your Silverlight application hosts in either HTML or ASPX page. In that page you will find the following code snippet where you have an tag. There are several <param /> tags inside it. Create one more param tag as mentioned above and set the value to that.

Read more: Kunal's Blog

Posted via email from .NET Info

0 comments: