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

[Solved] Problem in ModalPopupExtender with Firefox

1 Answer 124 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Khanh Phan Van
Top achievements
Rank 1
Khanh Phan Van asked on 01 Sep 2009, 06:48 AM
Dear all and Telerik,
I have the code below
<asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional"
    <ContentTemplate> 
        <asp:Panel ID="pnlSignatureUpdate" runat="server" Width="850px" Style="display: none;" 
            CssClass="Popup_Table"
            <table border="0" class="Popup_Title" cellpadding="0" cellspacing="0" style="width: 100%"
                <tr> 
                    <td> 
                        <b>::<%=ResxManager.GetString("Report_Signature") %>::</b></td
                    <td style="width: 20px; padding-right: 2px;" align="center"
                        <div style="height: 17px; width: 16px; text-align: center;" class="Popup_BtClose"
                            <asp:LinkButton ID="lbtClose" runat="server" Style="height: 17px;" CssClass="Popup_BtClose" 
                                OnClick="btnCancel_Click">&nbsp;&nbsp;&nbsp;&nbsp;</asp:LinkButton></div
                    </td> 
                </tr> 
            </table> 
            <table border="0" class="Popup_Content" cellpadding="0" cellspacing="0" width="100%"
                <tr> 
                    <td align="center"
                            <telerik:RadEditor ID="txtSignature" runat="server" BackColor="White" CssClass="qsfClear" 
                                EnableResize="False" Skin="Outlook" ToolsFile="~/Controls/RadEditorTools.xml" 
                                Width="100%" Height="400px"
                                <Content></Content
                            </telerik:RadEditor> 
                    </td> 
                </tr> 
                <tr> 
                    <td style="padding-right: 3px;"
                        <asp:CheckBox ID="chkUse" runat="server" Text="Use as default" /></td
                </tr> 
                <tr> 
                    <td align="center" style="padding-top: 3px; padding-bottom: 3px"
                        <asp:Button ID="btnSaveSign" runat="server" Text="OK" OnClick="btnSaveSign_Click" 
                            ValidationGroup="Signature" CssClass="Control_Button0" EnableViewState="False" /> 
                        <asp:Button ID="btnCancelSign" runat="server" Text="Cancel" CssClass="Control_Button0" EnableViewState="False" /></td
                </tr> 
            </table> 
        </asp:Panel> 
        <div id="divSignature" runat="server"
        </div> 
        <ajax:ModalPopupExtender ID="mdpSignature" runat="server" TargetControlID="divSignature" 
            CancelControlID="btnCancelSign" PopupControlID="pnlSignatureUpdate" BackgroundCssClass="ModalPopupBackground"
        </ajax:ModalPopupExtender> 
    </ContentTemplate> 
    <Triggers> 
        <asp:AsyncPostBackTrigger ControlID="lbtChangeSignature" EventName="Click" /> 
    </Triggers> 
</asp:UpdatePanel> 
protected void lbtChangeSignature_Click(object sender, EventArgs e) 
    { 
        Data objData = new Data(); 
        try 
        { 
            objData.Connect(); 
            objData.CreateNewStoredProceder("Profile_User_DefinitionInfor_GetSignature"); 
            objData.SqlCommand.Parameters.AddWithValue("@Username", User.strUsername); 
            DataTable dt = objData.ExcuteStoredProcedureToDataTable(); 
            if (dt != null && dt.Rows.Count > 0) 
            { 
                txtSignature.Content = dt.Rows[0]["Signature"].ToString(); 
                chkUse.Checked = Convert.ToBoolean(dt.Rows[0]["IsSignatureUsed"].ToString()); 
            } 
        } 
        catch (Exception objEx) 
        { 
            new SystemMessage("", "", "MD_Reports/Reports.ascx/lbtChangeSignature_Click() <BR />" + objEx.Message).MailToSystem(); 
        } 
        finally 
        { 
            objData.DeConnect(); 
            mdpSignature.Show(); 
        } 
    } 
protected void btnSaveSign_Click(object sender, EventArgs e) 
    {         
        Data objData = new Data(); 
        try 
        { 
            objData.Connect(); 
            objData.CreateNewStoredProceder("Profile_User_DefinitionInfor_UpdateSignature"); 
            objData.SqlCommand.Parameters.AddWithValue("@Username", User.strUsername); 
>>>>>>>>>   objData.SqlCommand.Parameters.AddWithValue("@Signature", txtSignature.Content.Trim()); (**********)
            objData.SqlCommand.Parameters.AddWithValue("@IsSignatureUsed", chkUse.Checked); 
            objData.SqlCommand.ExecuteNonQuery(); 
        } 
        catch (Exception objEx) 
        { 
            new SystemMessage("MD_Reports/Reports.ascx/lbtChangeSignature_Click()", "", "MD_Reports/Reports.ascx/lbtChangeSignature_Click() <BR />" + objEx.ToString()).MailToSystem(); 
        } 
        finally 
        { 
            objData.DeConnect(); 
            mdpSignature.Hide(); 
        } 
    }


In IE 7 and 8, it run normally, but, in Firefox, the marked code (start with >>>>>>>>>), txtSignature always the previous input at show modal popup instead the current text display on RadEditor.

I think this is a bug for Telerik.
Please help me fix this.

Best regard,

1 Answer, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 03 Sep 2009, 02:31 PM
Hello,

For some reason the editor content is not submitted when you click the OK button in the modal popup extender. To fix this, you need to manually save the editor content before the ajax request. To do this, add a OnClientClick property for the OK button:

<asp:Button ID="btnSaveSign" runat="server" Text="OK" OnClientClick="saveEditorContent()" ... 

and add the saveEditorContent() JavaScript function somewhere on your page (it should be outside the UpdatePanel, I put it just under the ScriptManager tag):

<script type="text/javascript"
    function saveEditorContent() 
    { 
        $find("txtSignature").saveContent(); 
    } 
</script> 
 

I tested this in your example and the editor content was correctly submitted in Firefox.

All the best,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Khanh Phan Van
Top achievements
Rank 1
Answers by
Lini
Telerik team
Share this question
or