Select to view content in your preferred language

Silverlight viewer URL parameter

2850
2
05-01-2013 01:07 PM
Hwa_SaupLee
Occasional Contributor
How can I use URL parameter with the Silverlight Viewer?  similar with Flex Viewer.
for example: http://serverName/SilverlightViewer/index.html?config=Config/Map2.xml

I would like to use the exact same application with multiple map configurations. 

Can it be possible?  It can be done in the flex viewer.
0 Kudos
2 Replies
DannyDong
Deactivated User
I wonder if you figured it out or not, but it is doable, like in the code snippet:

 if (HtmlPage.Document.QueryString.Keys.Contains("xVal1"))
                xVal1 = HtmlPage.Document.QueryString["xVal1"].ToString();


In the URL, you pass something like aspx?xVal1=100, or even htm?xVal1=100 to the code behind.

Z
0 Kudos
BrianLeroux
Frequent Contributor
Definately possible. I do something similar to what you mention. I am taking URL parameters when the viewer initializes and querying using the parameters to populate the map contents. Below is the code I use to get parameters from the URL.

public void getECFParameters()
        {
            Dictionary<string, string> urlparams = HtmlPage.Document.QueryString as Dictionary<string, string>;
            urlparams.TryGetValue("CAT", out ecfCAT);
            urlparams.TryGetValue("DOL", out ecfDate);
            urlparams.TryGetValue("COV", out ecfCov);
            urlparams.TryGetValue("POLNO", out ecfPOLNO);            

            if (ecfCAT == "null")
                ecfCAT = null;

            if (ecfCov == "null")
                ecfCov = null;
            
        }
0 Kudos