开发者

Sharepoint InputFormTextBox not working on updatepanel?

开发者 https://www.devze.com 2022-12-25 23:01 出处:网络
I have two panels in update panel. In panel1, there is button. If I click, Panel1 will be visible =false and Panel2 will be visible=true. In Panel2, I placed SharePoint:InPutFormTextBox. It not render

I have two panels in update panel. In panel1, there is button. If I click, Panel1 will be visible =false and Panel2 will be visible=true. In Panel2, I placed SharePoint:InPutFormTextBox. It not rendering HTML toolbar an开发者_运维百科d showing like below image.

 <SharePoint:InputFormTextBox runat="server"   ID="txtSummary" ValidationGroup="CreateCase" Rows="8" Columns="80" RichText="true" RichTextMode="Compatible" AllowHyperlink="true" TextMode="MultiLine" />

http://i700.photobucket.com/albums/ww5/vsrikanth/careersummary-1.jpg


SharePoint rich text fields start out as text areas, and some javascript in the page load event replaces them with a different control if you are using a supported browser.

With an update panel, the page isn't being loaded, so that script never gets called.

Try hiding the section using css/javascript rather than the server side visible property. That generally lets you make whatever changes you need to the form without sharepoint seeing any changes.


                    <SharePoint:InputFormTextBox ID="tbComment" CssClass="sp-comment-textarea" runat="server" TextMode="MultiLine" RichText="True"></SharePoint:InputFormTextBox>
                    <%--textbox for temporay focus - trick the IE behavior on partial submit--%>
                    <input type="text" id="<%= tbComment.ClientID %>_hiddenFocusInput_" style="width: 0px; height: 0px; position: absolute; top: -3000px;" />
                    <%--tricking code that makes the 'SharePoint:InputFormTextBox' to work correctly in udate panel on partial podtback--%>
                    <script id="<%= tbComment.ClientID %>_InputFormTextBoxAfterScript" type="text/javascript">
                        (function () {
                            // where possible rich textbox only
                            if (browseris.ie5up && (browseris.win32 || browseris.win64bit) && !IsAccessibilityFeatureEnabled()) {
                                //  find this script element
                                var me = document.getElementById("<%= tbComment.ClientID %>_InputFormTextBoxAfterScript");
                                if (me) {
                                    // search for script block of the rich textbox initialization
                                    var scriptElement = me.previousSibling;
                                    while (scriptElement && (scriptElement.nodeType != 1 || scriptElement.tagName.toLowerCase() != "script")) {
                                        scriptElement = scriptElement.previousSibling;
                                    }
                                    // get the content of the found script block
                                    var innerContent = scriptElement.text;
                                    if (typeof innerContent == 'undefined') {
                                        innerContent = scriptElement.innerHTML
                                    }
                                    // get text with function call that initializes the rich textbox
                                    var callInitString = "";
                                    innerContent.toString().replace(/(RTE_ConvertTextAreaToRichEdit\([^\)]+\))/ig, function (p0, p1) { callInitString = p1; });
                                    // register on page load (partial updates also)
                                    Sys.Application.add_load(function (sender, args) {
                                        setTimeout(function () {
                                            // get the toolbar of the rich textbox
                                            var toolbar = $get("<%= tbComment.ClientID %>_toolbar");
                                            // if not found then we should run initialization
                                            if (!toolbar) {
                                                // move focus to the hidden input
                                                $get("<%= tbComment.ClientID %>_hiddenFocusInput_").focus();
                                                // reset some global variables of the SharePoint rich textbox
                                                window.g_aToolBarButtons = null;
                                                window.g_fRTEFirstTimeGenerateCalled = true;
                                                window.g_oExtendedRichTextSupport = null;
                                                parent.g_oExtendedRichTextSupport = null;
                                                // call the initialization code
                                                eval(callInitString);
                                                setTimeout(function () {
                                                    // call 'onload' code of the rich textbox
                                                    eval("RTE_TextAreaWindow_OnLoad('<%= tbComment.ClientID %>');");
                                                }, 0);
                                            }
                                        }, 0);
                                    });
                                }
                            }
                        })();
                    </script>
0

精彩评论

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