コード例 #1
0
ファイル: ResponseFilter.cs プロジェクト: proson/Fine-UI
        /// <summary>
        /// 更新ASP.NET控件
        /// </summary>
        /// <param name="sb"></param>
        /// <param name="doc"></param>
        private void UpdateASPNETControls(StringBuilder sb, HtmlDocument doc)
        {
            if (PageManager.Instance.AjaxAspnetControls == null)
            {
                return;
            }
            foreach (string controlId in PageManager.Instance.AjaxAspnetControls)
            {
                string  controlClientID = controlId;
                Control control         = ControlUtil.FindControl(controlId);
                if (control != null)
                {
                    controlClientID = control.ClientID;
                }
                string updateHtml = JsHelper.Enquote(GetHtmlNodeOuterHTML(controlClientID, doc));
                if (updateHtml != null)
                {
                    sb.Append(String.Format("F.util.replace('{0}', {1});", controlClientID, updateHtml));

                    /*
                     * // 如果是Asp.net按钮或者ImageButton,需要重新注册点击时AJAX回发页面,而不是调用Button(type=submit)的默认行为
                     * if (control != null && (control is System.Web.UI.WebControls.Button
                     || control is System.Web.UI.WebControls.ImageButton))
                     ||{
                     || sb.Append(String.Format("F.util.makeAspnetSubmitButtonAjax('{0}');", control.ClientID));
                     ||}
                     * */
                }
            }
        }
コード例 #2
0
ファイル: Button.cs プロジェクト: 15831944/C-12-
        /// <summary>
        /// 获取按钮客户端点击事件的脚本
        /// </summary>
        /// <param name="validateForms">验证表单列表</param>
        /// <param name="validateTarget">表单验证提示消息目标页面</param>
        /// <param name="validateMessageBox">是否显示表单验证提示对话框</param>
        /// <param name="enablePostBack">启用回发</param>
        /// <param name="postBackEventReference">回发脚本</param>
        /// <param name="confirmText">确认对话框消息</param>
        /// <param name="confirmTitle">确认对话框标题</param>
        /// <param name="confirmIcon">确认对话框图标</param>
        /// <param name="confirmTarget">确认对话框目标页面</param>
        /// <param name="onClientClick">自定义客户端点击脚本</param>
        /// <param name="disableControlJavascriptID">需要禁用的控件客户端ID</param>
        /// <returns>客户端脚本</returns>
        internal static string ResolveClientScript(string[] validateForms, Target validateTarget, bool validateMessageBox, bool enablePostBack, string postBackEventReference,
                                                   string confirmText, string confirmTitle, MessageBoxIcon confirmIcon, Target confirmTarget, string onClientClick, string disableControlJavascriptID)
        {
            // 1. 表单验证
            string validateScript = String.Empty;

            if (validateForms != null && validateForms.Length > 0)
            {
                JsArrayBuilder array = new JsArrayBuilder();
                foreach (string formID in validateForms)
                {
                    Control control = ControlUtil.FindControl(formID);
                    if (control != null && control is ControlBase)
                    {
                        array.AddProperty((control as ControlBase).ClientID);
                    }
                }

                validateScript = String.Format("if(!X.util.validForms({0},'{1}',{2})){{return false;}}", array.ToString(), TargetHelper.GetName(validateTarget), validateMessageBox.ToString().ToLower());
            }

            // 2. 用户自定义脚本
            string clientClickScript = onClientClick;

            if (!String.IsNullOrEmpty(clientClickScript) && !clientClickScript.EndsWith(";"))
            {
                clientClickScript += ";";
            }


            // 3. 回发脚本
            string postBackScript = String.Empty;

            if (enablePostBack)
            {
                if (!String.IsNullOrEmpty(disableControlJavascriptID))
                {
                    postBackScript += String.Format("X.disable('{0}');", disableControlJavascriptID);
                }
                postBackScript += postBackEventReference;
            }

            // 确认对话框
            if (!String.IsNullOrEmpty(confirmText))
            {
                postBackScript = Confirm.GetShowReference(confirmText, confirmTitle, confirmIcon, postBackScript, "", confirmTarget);
            }

            return(validateScript + clientClickScript + postBackScript);
        }
コード例 #3
0
ファイル: ControlUtil.cs プロジェクト: goupviet/FineUI
        /// <summary>
        /// 获得服务器控件ID的客户端ID数组
        /// </summary>
        /// <param name="serverIDs"></param>
        /// <returns></returns>
        public static JsArrayBuilder GetControlClientIDs(string[] serverIDs)
        {
            JsArrayBuilder array = new JsArrayBuilder();

            foreach (string controlID in serverIDs)
            {
                Control control = ControlUtil.FindControl(controlID);
                if (control != null && control is ControlBase)
                {
                    array.AddProperty((control as ControlBase).ClientID);
                }
            }
            return(array);
        }
コード例 #4
0
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();

            // 不渲染
            RenderWrapperNode = false;

            // 这个是必须的,2009-08-04
            // 因为每个页面都会有 PageManager 控件,每个页面要至少调用 GetPostBackEventReference 一次,以在页面产生 __doPostBack 函数。
            Page.ClientScript.GetPostBackEventReference(this, "");

            // Move it to ResourceManager.cs
            // 为页面的 Form 添加 autocomplete="off" 属性
            // 参考http://www.cnblogs.com/sanshi/archive/2009/09/04/1560146.html#1635830
            // Page.Form.Attributes["autocomplete"] = "off";

            #region HideScrollbars

            if (HideScrollbars)
            {
                //if (Page.Request.UserAgent.ToLower().Contains("msie"))
                //{
                //    //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "noscroll", String.Format("window.document.body.scroll='no';"), true);
                //    AddStartupAbsoluteScript("window.document.body.scroll='no';");
                //}
                //else
                //{
                //    //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "noscroll",  String.Format("window.document.body.style.overflow='hidden';"), true);
                //    AddStartupAbsoluteScript("window.document.body.style.overflow='hidden';");
                //}
                AddStartupAbsoluteScript("X.util.hideScrollbar();");
            }

            #endregion

            #region PageLoading



            if (!PageLoadingControlExist)
            {
                string jsContent = String.Empty;

                if (EnablePageLoading)
                {
                    jsContent += "X.util.removePageLoading(false);";
                }

                AddStartupAbsoluteScript(jsContent);
            }


            #endregion

            //#region EnableAjax

            //if (!EnableAjax)
            //{
            //    AddStartupAbsoluteScript("X.global_disable_ajax=true;");
            //}

            //#endregion

            #region AutoSizePanelID

            if (!String.IsNullOrEmpty(AutoSizePanelID))
            {
                PanelBase autosizePanel = ControlUtil.FindControl(Page.Form, AutoSizePanelID) as PanelBase;

                if (autosizePanel != null)
                {
                    #region oldcode
                    //string resizePanelScript = String.Empty;

                    //resizePanelScript += String.Format("{0}_resize_outerpanel=function(){{var panel=Ext.getCmp('{1}');panel.setSize(Ext.getBody().getSize());panel.doLayout();}};", ClientJavascriptID, panel.ClientID);
                    //resizePanelScript += String.Format("{0}_resize_outerpanel();", ClientJavascriptID);
                    //resizePanelScript += String.Format("if(Ext.isIE){{X.{0}_resize_outerpanel.defer(60);}}", ClientJavascriptID);
                    //resizePanelScript += String.Format("Ext.EventManager.onWindowResize(function(){{X.{0}_resize_outerpanel();}},box);", ClientJavascriptID);

                    //AddAbsoluteStartupScript(resizePanelScript);

                    // X._3=new Ext.FormViewport({renderTo:"RegionPanel1_wrapper",id:"RegionPanel1",layout:"border",items:[X._1,X._2],bodyStyle:"",border:false,animCollapse:false});

                    #endregion

                    // 子节点不向页面输出HTML,此PageManager向页面输出HTML
                    autosizePanel.RenderWrapperNode = false;
                    RenderWrapperNode = true;

                    OB.AddProperty("layout", "fit");
                    OB.AddProperty("border", false);
                    OB.AddProperty("items", String.Format("{0}", autosizePanel.XID), true);

                    string jsContent = String.Format("var {0}=new Ext.ux.FormViewport({1});", XID, OB.ToString());

                    AddStartupAbsoluteScript(jsContent);
                }
            }

            #endregion

            //if (EnableBigFont)
            //{
            //    AddStartupAbsoluteScript("Ext.getBody().addClass('bigfont');");
            //}

            #region oldcode

            // Move to X.util.init
            // Asp.Net Buttons(type="submit")
            // AddStartupAbsoluteScript("X.util.makeAspnetSubmitButtonAjax();");

            #endregion
        }
コード例 #5
0
        /// <summary>
        /// 生成按钮客户端点击事件的脚本
        /// </summary>
        /// <param name="validateForms"></param>
        /// <param name="validateTarget"></param>
        /// <param name="enablePostBack"></param>
        /// <param name="postBackEventReference"></param>
        /// <param name="confirmText"></param>
        /// <param name="confirmTitle"></param>
        /// <param name="confirmIcon"></param>
        /// <param name="confirmTarget"></param>
        /// <param name="onClientClick"></param>
        /// <param name="disableControlJavascriptID"></param>
        /// <returns></returns>
        internal static string ResolveClientScript(string[] validateForms, Target validateTarget, bool validateMessageBox, bool enablePostBack, string postBackEventReference,
                                                   string confirmText, string confirmTitle, MessageBoxIcon confirmIcon, Target confirmTarget, string onClientClick, string disableControlJavascriptID)
        {
            // 1. validateScript
            string validateScript = String.Empty;

            if (validateForms != null && validateForms.Length > 0)
            {
                #region old code

                //StringBuilder sb = new StringBuilder();
                //sb.Append("var forms=[];");
                //foreach (string formId in validateForms)
                //{
                //    Control control = ControlUtil.FindControl(formId);
                //    if (control != null && control is ControlBase)
                //    {
                //        sb.AppendFormat("forms.push(X.{0});", (control as ControlBase).ClientJavascriptID);
                //    }
                //}
                ////sb.Append("if(!box_validForms(forms,'表单不完整','请为 “{0}” 提供有效值!')){return false;}");
                //sb.AppendFormat("var validResult=X.util.validForms(forms);if(!validResult[0]){{{0}return false;}}",
                //    Alert.GetShowReference("请为 “'+validResult[1].fieldLabel+'” 提供有效值!", "表单不完整"));

                #endregion
                JsArrayBuilder array = new JsArrayBuilder();
                foreach (string formID in validateForms)
                {
                    Control control = ControlUtil.FindControl(formID);
                    if (control != null && control is ControlBase)
                    {
                        array.AddProperty((control as ControlBase).ClientID);
                    }
                }

                validateScript = String.Format("if(!X.util.validForms({0},'{1}',{2})){{return false;}}", array.ToString(), TargetHelper.GetName(validateTarget), validateMessageBox.ToString().ToLower());
            }

            // 2. 用户自定义脚本
            string clientClickScript = onClientClick;
            if (!String.IsNullOrEmpty(clientClickScript) && !clientClickScript.EndsWith(";"))
            {
                clientClickScript += ";";
            }


            // 3. 回发脚本
            string postBackScript = String.Empty;
            if (enablePostBack)
            {
                if (!String.IsNullOrEmpty(disableControlJavascriptID))
                {
                    postBackScript += String.Format("X.disable('{0}');", disableControlJavascriptID);
                    //postBackScript += String.Format("X.util.setHiddenFieldValue('{0}','{1}');", ResourceManager.DISABLED_CONTROL_BEFORE_POSTBACK, disableControlClientId);
                    //postBackScript += String.Format("X.util.setDisabledControlBeforePostBack('{0}');", disableControlJavascriptID);
                }
                postBackScript += postBackEventReference;
            }



            if (!String.IsNullOrEmpty(confirmText))
            {
                #region old code

                // 对confirm进行处理,对<script></script>包含的内容做js代码处理
                //string confirmText = ConfirmText.Replace("'", "\"");
                //if (confirmText.Contains("<script>"))
                //{
                //    confirmText = confirmText.Replace("<script>", "'+");
                //    confirmText = confirmText.Replace("</script>", "+'");
                //}
                //confirmText = String.Format("'{0}'", confirmText);

                //JsObjectBuilder ob = new JsObjectBuilder();
                //ob.AddProperty(OptionName.Title, String.Format("'{0}'", confirmTitle), true);
                //ob.AddProperty(OptionName.Msg, String.Format("'{0}'", JsHelper.GetStringWithJsBlock(confirmText)), true);
                //ob.AddProperty(OptionName.Buttons, "Ext.MessageBox.OKCANCEL", true);
                //ob.AddProperty(OptionName.Icon, String.Format("'{0}'", MessageBoxIconName.GetName(confirmIcon)), true);
                //ob.AddProperty(OptionName.Fn, String.Format("function(btn){{if(btn=='cancel'){{return false;}}else{{{0}}}}}", postBackScript), true);

                //postBackScript = String.Format("Ext.MessageBox.show({0});", ob.ToString());

                #endregion
                postBackScript = Confirm.GetShowReference(confirmText, confirmTitle, confirmIcon, postBackScript, "return false;", confirmTarget);
            }



            return(validateScript + clientClickScript + postBackScript);
        }
コード例 #6
0
        /// <summary>
        /// 渲染 HTML 之前调用(页面第一次加载或者普通回发)
        /// </summary>
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();


            #region validate properties

            if (Required)
            {
                OB.AddProperty("allowBlank", false);
                if (!String.IsNullOrEmpty(RequiredMessage))
                {
                    OB.AddProperty("blankText", RequiredMessage);
                }
            }

            if (MaxLength != null)
            {
                OB.AddProperty("maxLength", MaxLength.Value);
                if (!String.IsNullOrEmpty(MaxLengthMessage))
                {
                    OB.AddProperty("maxLengthText", MaxLengthMessage);
                }
            }
            if (MinLength != null)
            {
                OB.AddProperty("minLength", MinLength.Value);
                if (!String.IsNullOrEmpty(MinLengthMessage))
                {
                    OB.AddProperty("minLengthText", MinLengthMessage);
                }
            }

            // Calculate regex expression via RegexPattern and Regex
            string regexStr = String.Empty;
            if (RegexPattern != RegexPattern.None)
            {
                regexStr = RegexPatternHelper.GetRegexValue(RegexPattern);
            }
            else if (!String.IsNullOrEmpty(Regex))
            {
                regexStr = Regex;
            }

            if (!String.IsNullOrEmpty(regexStr))
            {
                string ignoreCaseStr = String.Empty;
                if (RegexIgnoreCase)
                {
                    ignoreCaseStr = ",'i'";
                }

                OB.AddProperty("regex", String.Format("new RegExp({0}{1})", JsHelper.Enquote(regexStr), ignoreCaseStr), true);
                if (!String.IsNullOrEmpty(RegexMessage))
                {
                    OB.AddProperty("regexText", RegexMessage);
                }
            }

            #endregion

            //OB.AddProperty("enableKeyEvents", true);

            #region NextFocusControl

            if (!String.IsNullOrEmpty(NextFocusControl))
            {
                Control nextControl = ControlUtil.FindControl(Page, NextFocusControl);

                if (nextControl != null && nextControl is ControlBase)
                {
                    //// true to enable the proxying of key events for the HTML input field (defaults to false)
                    //OB.AddProperty("enableKeyEvents", true);
                    // Fires when any key related to navigation (arrows, tab, enter, esc, etc.) is pressed.
                    OB.Listeners.AddProperty("specialkey", String.Format("function(field,e){{if(e.getKey()==e.ENTER){{{0}.focus(true,10);e.stopEvent();}}}}", (nextControl as ControlBase).XID), true);
                }
            }

            #endregion

            #region ControlToCompare

            string compareValue = String.Empty;
            // 如果CompareControl 和 CompareValue 同时存在,则 CompareControl 拥有更高的优先级
            if (!String.IsNullOrEmpty(CompareControl))
            {
                Control compareControl = ControlUtil.FindControl(Page, CompareControl);
                if (compareControl != null && compareControl is ControlBase)
                {
                    compareValue = String.Format("F.fieldValue({0})", JsHelper.Enquote((compareControl as ControlBase).ClientID));
                }
            }
            else if (!String.IsNullOrEmpty(CompareValue))
            {
                compareValue = CompareValue;
                if (CompareType == CompareType.String)
                {
                    compareValue = JsHelper.Enquote(compareValue);
                }
            }

            // Check whether compareValue exist, which may produced from CompareControl or CompareValue.
            if (!String.IsNullOrEmpty(compareValue))
            {
                string compareOperatorJs       = OperatorHelper.GetName(CompareOperator);
                string compareExpressionScript = String.Empty;
                if (CompareType == CompareType.String)
                {
                    compareExpressionScript = String.Format("value{0}{1}", compareOperatorJs, compareValue);
                }
                else if (CompareType == CompareType.Int)
                {
                    compareExpressionScript = String.Format("parseInt(value,10){0}parseInt({1},10)", compareOperatorJs, compareValue);
                }
                else if (CompareType == CompareType.Float)
                {
                    compareExpressionScript = String.Format("parseFloat(value){0}parseFloat({1})", compareOperatorJs, compareValue);
                }

                string compareScript = String.Format("if({0}){{return true;}}else{{return {1};}}", compareExpressionScript, JsHelper.Enquote(CompareMessage));
                OB.AddProperty("validator", String.Format("function(){{var value=F.fieldValue(this);{0}}}", compareScript), true);
            }

            #endregion
        }
コード例 #7
0
ファイル: WindowField.cs プロジェクト: JesterWang/FineUI
        internal override object GetColumnValue(GridRow row)
        {
            HtmlNodeBuilder nb = new HtmlNodeBuilder("a");

            #region DataTextField

            if (!String.IsNullOrEmpty(DataTextField))
            {
                object value = row.GetPropertyValue(DataTextField);

                //if (!String.IsNullOrEmpty(DataTextFormatString))
                //{
                //    nb.InnerProperty = String.Format(DataTextFormatString, value);
                //}
                //else
                //{
                //    nb.InnerProperty = value.ToString();
                //}
                string text = String.Empty;
                if (value != null)
                {
                    if (!String.IsNullOrEmpty(DataTextFormatString))
                    {
                        text = String.Format(DataTextFormatString, value);
                    }
                    else
                    {
                        text = value.ToString();
                    }

                    if (HtmlEncode)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }

                nb.InnerProperty = text;
            }
            else
            {
                nb.InnerProperty = Text;
            }

            #endregion

            if (Enabled)
            {
                string url = "#";

                #region DataIFrameUrlFields

                string hrefOriginal = String.Empty;

                if (!String.IsNullOrEmpty(DataIFrameUrlFields))
                {
                    string[] fields = DataIFrameUrlFields.Trim().TrimEnd(',').Split(',');

                    List <object> fieldValues = new List <object>();
                    foreach (string field in fields)
                    {
                        if (!String.IsNullOrEmpty(field))
                        {
                            //fieldValues.Add(row.GetPropertyValue(field));
                            object fieldObj = row.GetPropertyValue(field);

                            string fieldValue = String.Empty;
                            if (fieldObj != null)
                            {
                                fieldValue = fieldObj.ToString();
                                if (UrlEncode)
                                {
                                    fieldValue = HttpUtility.UrlEncode(fieldValue);
                                }
                            }
                            fieldValues.Add(fieldValue);
                        }
                    }


                    if (!String.IsNullOrEmpty(DataIFrameUrlFormatString))
                    {
                        hrefOriginal = String.Format(DataIFrameUrlFormatString, fieldValues.ToArray());
                    }
                    else
                    {
                        if (fieldValues.Count > 0)
                        {
                            hrefOriginal = fieldValues[0].ToString();
                        }
                    }
                }
                else
                {
                    hrefOriginal = IFrameUrl;
                }

                url = Grid.ResolveUrl(hrefOriginal);

                #endregion

                string title = String.Empty;

                #region DataTextField

                if (!String.IsNullOrEmpty(DataWindowTitleField))
                {
                    object value = row.GetPropertyValue(DataWindowTitleField);

                    if (value != null)
                    {
                        if (!String.IsNullOrEmpty(DataWindowTitleFormatString))
                        {
                            title = String.Format(DataWindowTitleFormatString, value);
                        }
                        else
                        {
                            title = value.ToString();
                        }
                    }
                }
                else
                {
                    title = Title;
                }

                #endregion

                #region WindowID

                if (!String.IsNullOrEmpty(WindowID))
                {
                    Window window = ControlUtil.FindControl(Grid.Page, WindowID) as Window;
                    if (window != null)
                    {
                        nb.SetProperty("href", "javascript:;");
                        nb.SetProperty("onclick", String.Format("javascript:{0}", window.GetShowReference(url, title)));
                        //nb.SetProperty("href", String.Format("javascript:X.{0}_show('{1}','{2}');", window.ClientID, url, title.Replace("'", "\"")));
                    }
                }

                #endregion
            }
            else
            {
                nb.SetProperty("class", "x-item-disabled");
                nb.SetProperty("disabled", "disabled");
            }

            string tooltip = GetTooltipString(row);

            #region Icon IconUrl

            string resolvedIconUrl = IconHelper.GetResolvedIconUrl(Icon, IconUrl);
            if (!String.IsNullOrEmpty(resolvedIconUrl))
            {
                nb.InnerProperty = String.Format("<img src=\"{0}\" {1} />", resolvedIconUrl, tooltip) + nb.InnerProperty;
            }

            #endregion

            //string result2 = nb.ToString();

            //#region Tooltip


            //if (!String.IsNullOrEmpty(tooltip))
            //{
            //    result2 = result2.ToString().Insert(2, tooltip);
            //}

            //#endregion

            //return result2;

            string result = nb.ToString();

            if (!String.IsNullOrEmpty(tooltip))
            {
                result = result.ToString().Insert("<a".Length, tooltip);
            }

            return(result);
        }
コード例 #8
0
ファイル: Button.cs プロジェクト: proson/Fine-UI
        /// <summary>
        /// 渲染 HTML 之前调用(页面第一次加载或者普通回发)
        /// </summary>
        protected override void OnFirstPreRender()
        {
            base.OnFirstPreRender();

            //ResourceManager.Instance.AddJavaScriptComponent("button");
            //if (Menu.Items.Count > 0)
            //{
            //    ResourceManager.Instance.AddJavaScriptComponent("menu");
            //}

            #region Properties
            if (TabIndex != null)
            {
                OB.AddProperty("tabIndex", TabIndex);
            }

            if (!String.IsNullOrEmpty(ToolTip))
            {
                OB.AddProperty("tooltip", ToolTip);
                OB.AddProperty("tooltipType", ToolTipTypeName.GetName(ToolTipType));
            }

            OB.AddProperty("text", Text);

            if (EnablePress)
            {
                OB.AddProperty("enableToggle", EnablePress);
                OB.AddProperty("pressed", Pressed);

                //hiddenFieldsScript += GetSetHiddenFieldValueScript(PressedHiddenFieldID, Pressed.ToString().ToLower());
                //string toggleScript = String.Format("function(btn,pressed){{F.util.setHiddenFieldValue('{0}',pressed);}}", PressedHiddenFieldID);
                //OB.Listeners.AddProperty(OptionName.Toggle, toggleScript, true);
            }

            //if (Type != ButtonType.Button)
            //{
            //    OB.AddProperty("type", ButtonTypeName.GetName(Type));
            //}



            if (Size != ButtonSize.Small)
            {
                OB.AddProperty("scale", ButtonSizeName.GetName(Size));
            }

            #endregion

            #region Icon IconUrl

            string resolvedIconUrl = IconHelper.GetResolvedIconUrl(Icon, IconUrl);
            if (!String.IsNullOrEmpty(resolvedIconUrl))
            {
                // 不需要先删除原来的属性,因为在AddProperty内部已经有这个逻辑了
                OB.AddProperty("cls", CssClass + " x-btn-text-icon");
                OB.AddProperty("icon", resolvedIconUrl);

                if (IconAlign != IconAlign.Left)
                {
                    OB.AddProperty("iconAlign", IconAlignHelper.GetName(IconAlign));
                }
            }

            #endregion

            #region Click

            string clickScript = GetClickScript();
            if (!String.IsNullOrEmpty(clickScript))
            {
                OB.AddProperty("handler", JsHelper.GetFunction(clickScript), true);
            }

            #endregion

            #region oldcode

            //string clickScriptFunction = GetClickScriptFunction();
            //if (AjaxPropertyChanged("ClickScriptFunction", clickScriptFunction))
            //{
            //    string ajaxClickFunction = String.Empty;
            //    //ajaxClickFunction += String.Format("{0}.purgeListeners('click');", ClientJavascriptID);
            //    ajaxClickFunction += String.Format("{0}.un('click', X.{0}.initialConfig.listeners.click);", XID);
            //    ajaxClickFunction += String.Format("{0}.on('click',{1});", XID, clickScriptFunction);

            //    AddAjaxPropertyChangedScript(ajaxClickFunction);
            //}

            //OB.Listeners.AddProperty(OptionName.Click, String.Format("{0}_click", ClientJavascriptID), true);


            //OB.AddProperty(OptionName.Handler, "function(){alert('sss');}", true);



            //string style = String.Empty;

            //if (CssStyle == "" || !CssStyle.ToLower().Contains("display"))
            //{
            //    style += CssStyle + "display:inline;";
            //}

            //OB.RemoveProperty(OptionName.Style);
            //OB.AddProperty(OptionName.Style, style);

            //AddExtraStyle("display", "inline");

            #endregion

            #region Menu

            if (_menu != null && Menu.Items.Count > 0)
            {
                OB.AddProperty("menu", Menu.XID, true);
            }
            else if (!String.IsNullOrEmpty(MenuID))
            {
                Menu contextMenu = ControlUtil.FindControl(this.Page, MenuID) as Menu;
                if (contextMenu != null)
                {
                    OB.AddProperty("menu", contextMenu.XID, true);
                }
            }


            #endregion

            #region Type

            string submitButtonScript = String.Empty;
            if (Type == ButtonType.Submit)
            {
                submitButtonScript = String.Format("F.submitbutton='{0}';", ClientID);
            }
            else if (Type == ButtonType.Reset)
            {
                OB.AddProperty("handler", JsHelper.GetFunction("F.util.reset();"), true);
            }

            #endregion

            string createScript = String.Format("var {0}=Ext.create('Ext.button.Button',{1});", XID, OB.ToString());
            AddStartupScript(submitButtonScript + createScript);
        }