开发者

Enable DOM Access for Silverlight Web Part in Sharepoint 2010

开发者 https://www.devze.com 2022-12-30 11:44 出处:网络
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.

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

精彩评论

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