Sharepoint InputFormTextBox无法在updatepanel上运行?

时间:2010-04-08 22:29:15

标签: sharepoint updatepanel

我在更新面板中有两个面板。在panel1中,有按钮。如果我单击,Panel1将显示为= false,Panel2将显示为= true。在Panel2中,我放置了SharePoint:InPutFormTextBox。它不呈现HTML工具栏并显示如下图像。

 <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

2 个答案:

答案 0 :(得分:0)

SharePoint富文本字段以文本区域开头,如果您使用支持的浏览器,则页面加载事件中的某些javascript会使用其他控件替换它们。

使用更新面板时,页面未加载,因此脚本永远不会被调用。

尝试使用css / javascript而不是服务器端可见属性隐藏该部分。这通常允许您对表单进行任何更改,而无需sharepoint查看任何更改。

答案 1 :(得分:0)

                    <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>