This is a migrated thread and some comments may be shown as answers.

RadTabStrip + RadAjaxPanel + Master Page + AddThis in Firefox

3 Answers 113 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 03 Aug 2010, 08:17 PM
I have a Master Page that is a child of another master page. The child master page has a RadTabStrip and RadMultiPage with a RadAjaxPanel to load tabs dynamically. The parent master page has an AddThis widget. For some reason, in Firefox (and only in Firefox), when I click on a tab for the first time, it loads fine, but with the following error:
Error: uncaught exception: [Exception... "Security error"  code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)"  location: "http://devweb.tmforum.org/community/ScriptResource.axd?d=k49SRXxqYWiQi1h5ak56cz6yVdfy-wma__9J5UH8u6pGwBj_haSG64G2I9bxGyRx0&t=633767702680000000 Line: 498"]

When I then click on a different tab nothing happens. If I remove the AddThis widget it works fine.

Also, on a simple aspx page, no master page with the same setup and the AddThis widget directly after the close of the RadAjaxPanel, there are no problems. 

Can anyone shine any light on this?

Thanks,
Boris Zakharin

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 06 Aug 2010, 11:45 AM
Hi Boris,

From the provided explanation I;m not able to isolate the cause oft he error you are facing. Could you please post some code from the problematic page so we could further research on it. Also if it is convenient for you please open a regular support ticket and send us sample runnable application which demonstrates the problem. This will give us the option to debug it locally and advise you further.


Regards,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Boris
Top achievements
Rank 1
answered on 06 Aug 2010, 02:46 PM
master.Master the main master page:
<%@ Master Language="C#" AutoEventWireup="true" %>
...
<%@ Import Namespace="CommunityServer" %>
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.UI" %>
 
<script runat="server" language="C#">
...
    private static readonly Regex REGEX_BETWEEN_TAGS = new Regex(@">\s+<", RegexOptions.Compiled);
    private static readonly Regex REGEX_LINE_BREAKS = new Regex(@"\n\s+", RegexOptions.Compiled);
 
 
    /// <summary>
    /// Initializes the <see cref="T:System.Web.UI.HtmlTextWriter"></see> object and calls on the child
    /// controls of the <see cref="T:System.Web.UI.Page"></see> to render.
    /// </summary>
    /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"></see> that receives the page content.</param>
    protected override void Render(HtmlTextWriter writer)
    {
        using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter()))
        {
            base.Render(htmlwriter);
            string html = htmlwriter.InnerWriter.ToString();
            html = REGEX_BETWEEN_TAGS.Replace(html, "> <");
            html = REGEX_LINE_BREAKS.Replace(html, "\n");
            writer.Write(html.Trim());
        }
    }
...
</script>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <CSControl:Head runat="Server" >
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
...
        <asp:ContentPlaceHolder runat="server" id="HeaderRegion" />
    </CSControl:Head>
    <CSControl:Script ID="script2" runat="server" Visible="true" Src="~/themes/tmforum/jquery/jquery.js" />
...
    </head>
    <body id="b" runat="server">
        <form runat="server">
        <asp:ScriptManager id="oSM" runat="server" />
 
        <table style="width:100%;" cellpadding="0" cellspacing="0"><tr><td align="center">
        <table style="width:1000px;" cellpadding="0" cellspacing="0"><tr><td>
<table style="text-align:left;" cellpadding="0" cellspacing="0"><tr><td>
...
                <div id="CommonSidebarRight">
                    <asp:ContentPlaceHolder id="rcr" runat="server" />
                </div>
            <div>
...
                 <div style="clear:both"></div>
        
        <table cellspacing="0" cellpadding="0" width="100%" >
    <tr>
                <td align="center" class="menusmall" style="height: 20px;" nowrap> <!-- AddThis Button BEGIN -->
                    <script type="text/javascript">
addthis_pub  = 'jphillips_tmforum';
addthis_logo_background = 'EFEFFF';
addthis_logo_color      = '666699';
addthis_brand           = 'TMForum.org';
addthis_options         = 'favorites, digg, delicious, myspace, facebook, google, live, more';
                    </script>
 
                 <p><a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')"
                            onmouseout="addthis_close()" onclick="return addthis_sendto()">
                            <img src="http://s7.addthis.com/button1-share.gif" width="125" height="16" border="0"
                                alt="" /></a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script></p>
                     
                    <!-- AddThis Button END -->
                    </td>
            </tr>
...
</table>
...
</td>
</tr></table>
        </form>
...
    </body>
</html>
The master page with the tabstrip (homepage.Master):
<%@ Master Language="C#" AutoEventWireup="true" MasterPageFile="master.Master" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
...
 
<script runat="server" type="text/C#">
...   
    public RadTabStrip RtsHome {
        get
        {
            return rtsHome;
        }
    }
     
    void Page_Load()
    {
        int userID = CommunityServer.Components.CSContext.Current.User.UserID;
 
        loginDate = GetPrevLoginDate(userID);
 
        for (int ctr = 0; ctr < rtsHome.Tabs.Count; ++ctr)
            rtsHome.Tabs[ctr].NavigateUrl = ConfigurationManager.AppSettings["CSBaseHref"] + "default.aspx?tab=" + ctr.ToString();      
        rtsHome.DataBind();
         
        if (!IsPostBack)
        {
            int selectedIndex = 0;
            if (Request["tab"] != null)
                selectedIndex = int.Parse(Request["tab"]);
            SelectTab(rtsHome.Tabs[selectedIndex]);
        }
         
    }
...
 
    private void rmpHome_PageViewCreated(object sender, RadMultiPageEventArgs e)
    {
        switch (e.PageView.ID)
        {
            case "rpvGroups":
                wucGroupActivity groups = new wucGroupActivity();
                groups.ID = "groups";
                groups.FirstPageView = firstPageView;
                e.PageView.Controls.Add(groups);
                break;
            case "rpvInbox":
                wucInbox inbox = new wucInbox();
                inbox.ID = "inbox";
                inbox.FirstPageView = firstPageView;
                e.PageView.Controls.Add(inbox);
                break;
            case "rpvConnections":
                wucConnections conn = new wucConnections();
                conn.ID = "conn";
                conn.FirstPageView = firstPageView;
                e.PageView.Controls.Add(conn);
                break;
            case "rpvBlogs":
                wucCombinedBlogControl cbc = new wucCombinedBlogControl();
                cbc.ID = "CBC";
                cbc.FirstPageView = firstPageView;
                e.PageView.Controls.Add(cbc);
                cbc.ShowSort = false;
                cbc.BlogControlStyle = wucCombinedBlogControl.ControlStyle.HomePage;
                cbc.SubscriptionOnly = true;
                cbc.EnableViewState = true;
                break;
            default:
                e.PageView.Controls.Add(new LiteralControl("Error"));
                break;
        }
    }
 
    protected void rtsHome_TabClick(object sender, RadTabStripEventArgs e)
    {
        SelectTab(e.Tab);
    }
 
    private void SelectTab(RadTab tab)
    {
        if (tab.NavigateUrl == "")
        {
            firstPageView = true;
            RadPageView view = new RadPageView();
            view.ID = tab.PageViewID;
            rmpHome.PageViews.Add(view);
            tab.PageView.Selected = true;
        }
        rtsHome.SelectedIndex = tab.Index;
    }
 
</script>
 
<asp:Content ContentPlaceHolderID="HeaderRegion" runat="server" >
<link rel="stylesheet" type="text/css" href="/include/subModal/subModal.css" />
<script type="text/javascript" src="/include/subModal/common.js"></script>
<script type="text/javascript" src="/include/subModal/subModal.js"></script>
<script type="text/javascript">
...
//Cookie name
var tabCookieName = "currentTab";
 
//Variable to hold reference to tabstrip
var tabstrip;
function onClientTabLoad(sender) {   
    //Get reference to tabstrip   
    tabstrip = sender;
}
 
function onTabSelecting(sender, args)
{
    if (args.get_tab().get_pageViewID())
    {
        args.get_tab().set_postBack(false);
    }
}
 
function saveTabIndex(tabText) {   
    //Call JS function to save cookie name, tab text,
    //and days before cookie should expire   
    setCookie(tabCookieName, tabText, 1);
}
 
//Cookie operation helper function
//Save the value to a cookie and set expiration date
function setCookie(c_name, value, expiredays) {   
    var exdate = new Date();   
    exdate.setDate(exdate.getDate() + expiredays);   
    document.cookie = c_name + "=" + escape(value) +       
        ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
 
function loadTabIndex(tabstrip) {   
    //If tabstrip reference isn't null
    if (tabstrip != null) {       
        //Get cookie value
        var tabText = getCookie(tabCookieName);       
        var historyLength = getCookie("historyLength");
        //If text from the cookie exists
        if (tabText != "" && tabText != null) {           
            //Set tabstrip selected index
            var tab = tabstrip.findTabByText(tabText);
            //Get tab object
            if (tab != null) {               
                tab.select(); //Select tab           
            }          
        }   
    }
}
 
//pageLoad automatically called by ASPNET AJAX when page ready
function pageLoad() {   
    //Must do tab strip select here so that 
    //multipage is initialized and updated   
    <%if (IsPostBack) { %>
    loadTabIndex(tabstrip);
    <%} %>
    setCookie("historyLength", window.history.length, 1);
}
 
//Cookie helper function
//Gets a cookie based on supplied name and returns value
//as a string
function getCookie(c_name) {   
    try {       
        if (document.cookie.length > 0) {           
            c_start = document.cookie.indexOf(c_name + "=");           
            if (c_start != -1) {               
                c_start = c_start + c_name.length + 1;               
                c_end = document.cookie.indexOf(";", c_start);               
                if (c_end == -1) c_end = document.cookie.length;               
                return unescape(document.cookie.substring(c_start, c_end));           
            }       
        }   
    } catch (err) { }   
     
    //If there is an error or no cookie
    //return an empty string
    return "";
}
function onClientTabSelected(sender, args) {   
    //Persist selected tab text
    var tabText = args.get_tab().get_text();   
    //Save text to a cookie using JavaScript   
    saveTabIndex(tabText);
}
 
function onClientTabUnselected(sender, args) {   
    //Persist selected tab text
    var tabText = args.get_tab().get_text();   
    //Save text to a cookie using JavaScript   
    setCookie(tabText, new Date(), 7);
    saveTabIndex(tabText);
}
 
</script>
 
    <CSControl:SelectedNavigation Selected="home" runat="Server" />
</asp:Content>
...
<asp:Content ContentPlaceHolderID="bcr" runat="server"><div class="grey_border">
    <telerik:RadAjaxLoadingPanel ID="loadPnlTabs" runat="server" EnableAjaxSkinRendering="true" Transparency="20" BackColor="#E0E0E0">
        <img alt="Loading..."
             src='<%=ConfigurationManager.AppSettings["CSBaseHRef"] %>themes/tmforum/images/theme/ajax-loader.gif'
             style="padding-top:100px"/>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxPanel ID="pnlTabs" runat="server" EnableAJAX="true" LoadingPanelID="loadPnlTabs">
    <telerik:RadTabStrip ID="rtsHome" runat="server" MultiPageID="rmpHome" Width="100%"
    OnClientTabSelected="onClientTabSelected" OnClientLoad="onClientTabLoad" Align="Justify"
    OnTabClick="rtsHome_TabClick" OnClientTabSelecting="onTabSelecting"
    OnClientTabUnSelected="onClientTabUnselected" CssClass="HomeTabStrip" Skin="" EnableEmbeddedSkins="false">
        <Tabs>
            <telerik:RadTab runat="server" PageViewID="rpvGroups" Text="Group Activity" CssClass="HomeTabWithFlag" SelectedCssClass="HomeTabWithFlagSelected" />
            <telerik:RadTab runat="server" PageViewID="rpvInbox" Text="Inbox" CssClass="HomeTabWithFlag" SelectedCssClass="HomeTabWithFlagSelected" />
            <telerik:RadTab runat="server" PageViewID="rpvConnections" Text="Connections' Activity" CssClass="HomeTabWithFlag" SelectedCssClass="HomeTabWithFlagSelected" />
            <telerik:RadTab runat="server" PageViewID="rpvBlogs" Text="Latest Blogs" CssClass="HomeTabWithFlag" SelectedCssClass="HomeTabWithFlagSelected" />
        </Tabs>
        <TabTemplate>
            <TMFUserControls:FN runat="server" ID="fnInbox" FlagType='<%# DataBinder.Eval(Container, "Index") %>' TabText='<%# DataBinder.Eval(Container, "Text") %>' HyperLink='<%# DataBinder.Eval(Container, "NavigateUrl") %>' StartDate='<%# loginDate %>' />
        </TabTemplate>
    </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="rmpHome" runat="server" SelectedIndex="0" Width="100%" OnPageViewCreated="rmpHome_PageViewCreated">
        </telerik:RadMultiPage>
    </telerik:RadAjaxPanel>
    <div style="float:left;">
        <asp:ContentPlaceHolder id="bcr" runat="server" />
    </div>
    <div style="float:right;">
        <asp:ContentPlaceHolder id="rcr" runat="server" />
    </div>
    <div style="clear:both;"></div>
    </div>
</asp:Content>
...
The child page (home.aspx):

<%@ Page EnableViewState="true" Language="C#" AutoEventWireup="true" Inherits="CommunityServer.Controls.CSThemePage"
    MasterPageFile="homepage.Master" SmartNavigation="true" %>
     
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Controls" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.IO.Compression" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<script runat="server" language="C#">
 
    public static class Compressor
    {
 
        public static byte[] Compress(byte[] data)
        {
            MemoryStream output = new MemoryStream();
            GZipStream gzip = new GZipStream(output,
                              CompressionMode.Compress, true);
            gzip.Write(data, 0, data.Length);
            gzip.Close();
            return output.ToArray();
        }
 
        public static byte[] Decompress(byte[] data)
        {
            MemoryStream input = new MemoryStream();
            input.Write(data, 0, data.Length);
            input.Position = 0;
            GZipStream gzip = new GZipStream(input,
                              CompressionMode.Decompress, true);
            MemoryStream output = new MemoryStream();
            byte[] buff = new byte[64];
            int read = -1;
            read = gzip.Read(buff, 0, buff.Length);
            while (read > 0)
            {
                output.Write(buff, 0, read);
                read = gzip.Read(buff, 0, buff.Length);
            }
            gzip.Close();
            return output.ToArray();
        }
    }
 
    User user = CSContext.Current.User;
 
    protected override object LoadPageStateFromPersistenceMedium()
    {
        String alteredViewState;
        byte[] bytes;
        Object rawViewState;
        LosFormatter fomatter = new LosFormatter();
        this.PageStatePersister.Load();
        alteredViewState = this.PageStatePersister.ViewState.ToString();
        bytes = Convert.FromBase64String(alteredViewState);
        bytes = Compressor.Decompress(bytes);
        rawViewState = fomatter.Deserialize(Convert.ToBase64String(bytes));
        return new Pair(this.PageStatePersister.ControlState, rawViewState);
    }
 
    protected override void SavePageStateToPersistenceMedium(object viewStateIn)
    {
        LosFormatter fomatter = new LosFormatter();
        StringWriter writer = new StringWriter();
        Pair rawPair;
        Object rawViewState;
        String rawViewStateStr;
        String alteredViewState;
        byte[] bytes;
        if (viewStateIn is Pair)
        {
            rawPair = ((Pair)viewStateIn);
            this.PageStatePersister.ControlState = rawPair.First;
            rawViewState = rawPair.Second;
        }
        else
        {
            rawViewState = viewStateIn;
        }
        fomatter.Serialize(writer, rawViewState);
        rawViewStateStr = writer.ToString();
        bytes = Convert.FromBase64String(rawViewStateStr);
        bytes = Compressor.Compress(bytes);
        alteredViewState = Convert.ToBase64String(bytes);
        this.PageStatePersister.ViewState = alteredViewState;
        this.PageStatePersister.Save();
    }
 
...
    void Page_Init()
    {
        RadTabStrip rtsHome = (RadTabStrip)((ASP.themes_tmforum_common_homepage_master)Master).RtsHome;
        rtsHome.DataBinding += rtsHome_Load;
    }
 
    protected void rtsHome_Load(object sender, EventArgs e)
    {
        RadTabStrip rtsHome = (RadTabStrip)sender;
        foreach (RadTab tab in rtsHome.Tabs)
            tab.NavigateUrl = "";
    }
 
</script>
<asp:Content ContentPlaceHolderID="tr" runat="server">
 
</asp:Content>
 
            
0
Maria Ilieva
Telerik team
answered on 11 Aug 2010, 12:50 PM
Hello Boris,

I researched on the provided code, however was not able to found anything obvious that may cause the described error. It will be best to open a regular support ticket and send us sample runnable application so we could debug it locally and further investigate on the root cause of the issue.


Best wishes,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Ajax
Asked by
Boris
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Boris
Top achievements
Rank 1
Share this question
or