Search code examples
asp.netajaxcontroltoolkit

Table on ASP website loses formatting


Okay, so maybe one of you can figure out what is going on here. On our ASP website, we have a table presents information about a user like so:

Screenshot 1, formatted table

There is a link on the page the produces a pop-up menu that allows the user to email the link to this page to a friend. After the user clicks the "Close" button on the pop-up form, however, this table loses its formatting and displays as such:

Screenshot 2, unformatted table

I've been able to trace the problem as far as the ajaxcontroltoolkit, in which the following function is being ran:

AjaxControlToolkit.HTMLEditor.addFormOnSubmit=function(e,d)
{
    var b="undefined",a=null,c=window.theForm;
    if(window.theForm!=a&&typeof window.theForm!=b)
    {
        if(c.AjaxControlToolkit_HTMLEditor_editPanels==a||typeof c.AjaxControlToolkit_HTMLEditor_editPanels==b)
        {
            c.originalOnSubmit_AjaxControlToolkit_HTMLEditor=window.theForm.onsubmit;
            c.AjaxControlToolkit_HTMLEditor_editPanels=[];
            window.theForm.onsubmit=AjaxControlToolkit.HTMLEditor.EditPanelsOnSubmit;
            if(window.__doPostBack!=a&&typeof window.__doPostBack!=b)
            if(window.__doPostBack_AjaxControlToolkit_HTMLEditor_original==a||typeof window.__doPostBack_AjaxControlToolkit_HTMLEditor_original==b)
            {
                window.__doPostBack_AjaxControlToolkit_HTMLEditor_original=window.__doPostBack;
                window.__doPostBack=AjaxControlToolkit.HTMLEditor.EditPanelsOnPostBack
            }
            if(window.ValidatorGetValue!=a&&typeof window.ValidatorGetValue!=b)
            if(window.ValidatorGetValue_AjaxControlToolkit_HTMLEditor_original==a||typeof window.ValidatorGetValue_AjaxControlToolkit_HTMLEditor_original==b)
            {window.ValidatorGetValue_AjaxControlToolkit_HTMLEditor_original=window.ValidatorGetValue;window.ValidatorGetValue=AjaxControlToolkit.HTMLEditor.ValidatorGetValue}
        }
        c.AjaxControlToolkit_HTMLEditor_editPanels.push({handler:e,editPanel:d})
    }
};

I should note that this is happening in all major browsers and not isolated to a single browser. Additionally, I believe that it is hitting this function because when I hover over the close button, I see javascript:__doPostBack('main_content_0$Close','')

I am at a loss for what is going on here and why this table is losing it's formatting. If anyone could help, it would be much appreciated.

The code in the ascx file creating the table:

<ItemTemplate>
    <asp:Placeholder runat="server" Visible='<%# IsNewGroup((string)DataBinder.Eval(Container.DataItem, "GroupTitle")) %>'>
        <tr>
            <td style="font-weight: bold; padding-left: 5px; border-bottom: 1px solid black;">
                <%# DataBinder.Eval(Container.DataItem, "GroupTitle") %>
            </td>
            <td style="font-weight: bold; border-bottom: 1px solid black;">
                Date Earned
            </td>
            <td style="font-weight: bold; border-bottom: 1px solid black;">
                Status
            </td>
        </tr>
    </asp:Placeholder>
    <tr>
        <td>
            &nbsp;
            <%#DataBinder.Eval(Container.DataItem, "CredentialName")%>
        </td>
        <td class="text_center">
            <%#DataBinder.Eval(Container.DataItem, "DateEarned")%>
        </td>
        <td>
            <%#DataBinder.Eval(Container.DataItem, "Status")%>
        </td>
    </tr>
</ItemTemplate>

Solution

  • It turns out that this issue was unrelated to AJAX. The problem was due to a bad IF/ELSE statement in the page load function of the page in the C# code; it wasn't properly binding the table data items on the page when the page was postback. On correcting this issue, the page now works fine.