开发者

Enable DOM Access for Silverlight Web Part in Sharepoint 2010

I am hosting a silverlight 3.0 control on my Sharepoint 2010 page. I am using the built-in Silverli开发者_如何学CghtWebPart web part, where I have provided the path for .xap file.

Its displaying properly, but when I try to access the System.Windows.Browser, its throwing an error. My code is:

public static string GetQueryString(string key)
        {
            try
            {
                var documentQueryString = (Dictionary<string, string>)System.Windows.Browser.HtmlPage.Document.QueryString;
                if (documentQueryString.ContainsKey(key))
                {
                    return documentQueryString[key].ToString();
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            return string.Empty;
        }

The error I am getting is: The DOM/scripting bridge is disabled. How do I enable this? I know if I host this in a ASP.NET page, I can add the param - <param name="enablehtmlaccess" value="true"/>. I have tried putting this webpart in a "content editor web part", and I have embedded the object tag to call the .xap file and its working totally fine. I need to make it work using the built-in Silverlight web part.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜