예제 #1
0
        protected override void createButton(HtmlTextWriter writer, ControlItem ctrl, WebGridView gdView)
        {
            if (!this.FLActive && GloFix.IsFlowItem(ctrl.ControlName))
                return;
            string command = "cmd" + ctrl.ControlName, text = ctrl.ControlText, imageUrl = ctrl.ImageUrl, mouseOverImageUrl = ctrl.MouseOverImageUrl, disenableImageUrl = ctrl.DisenableImageUrl;
            int size = ctrl.Size;
            bool IsVisible = IsControlVisible(ctrl);
            if (ctrl.ControlName == "Notify" && this.FLNotifyOff)
                IsVisible = false;
            bool IsEnable = this.DesignMode ? true : getUserSetEnabled(ctrl.ControlName, this.CurrentNavState);
            CtrlType ct = ctrl.ControlType;
            ClientScriptManager csm = Page.ClientScript;

            string tooltiptext = "";
            if (!this.DesignMode)
            {
                tooltiptext = SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLTools", "FLWebNavigator", "ControlText", true);
                string[] arrtext = tooltiptext.Split(';');
                switch (ctrl.ControlName)
                {
                    case "First":
                        text = arrtext[0];
                        tooltiptext = arrtext[0];
                        break;
                    case "Previous":
                        text = arrtext[1];
                        tooltiptext = arrtext[1];
                        break;
                    case "Next":
                        text = arrtext[2];
                        tooltiptext = arrtext[2];
                        break;
                    case "Last":
                        text = arrtext[3];
                        tooltiptext = arrtext[3];
                        break;
                    case "Add":
                        text = arrtext[4];
                        tooltiptext = arrtext[4];
                        break;
                    case "Update":
                        text = arrtext[5];
                        tooltiptext = arrtext[5];
                        break;
                    case "Delete":
                        text = arrtext[6];
                        tooltiptext = arrtext[6];
                        break;
                    case "OK":
                        text = arrtext[7];
                        tooltiptext = arrtext[7];
                        break;
                    case "Cancel":
                        text = arrtext[8];
                        tooltiptext = arrtext[8];
                        break;
                    case "Apply":
                        text = arrtext[9];
                        tooltiptext = arrtext[9];
                        break;
                    case "Abort":
                        text = arrtext[10];
                        tooltiptext = arrtext[10];
                        break;
                    case "Query":
                        text = arrtext[11];
                        tooltiptext = arrtext[11];
                        break;
                    case "Print":
                        text = arrtext[12];
                        tooltiptext = arrtext[12];
                        break;
                    case "Export":
                        text = arrtext[13];
                        tooltiptext = arrtext[13];
                        break;
                    case "Submit":
                        text = arrtext[14];
                        tooltiptext = arrtext[14];
                        break;
                    case "Approve":
                        text = arrtext[15];
                        tooltiptext = arrtext[15];
                        break;
                    case "Return":
                        text = arrtext[16];
                        tooltiptext = arrtext[16];
                        break;
                    case "Reject":
                        text = arrtext[17];
                        tooltiptext = arrtext[17];
                        break;
                    case "Notify":
                        text = arrtext[18];
                        tooltiptext = arrtext[18];
                        break;
                    case "FlowDelete":
                        text = arrtext[19];
                        tooltiptext = arrtext[19];
                        break;
                    case "Plus":
                        text = arrtext[20];
                        tooltiptext = arrtext[20];
                        break;
                    case "Pause":
                        text = arrtext[21];
                        tooltiptext = arrtext[21];
                        break;
                    case "Comment":
                        text = arrtext[22];
                        tooltiptext = arrtext[22];
                        break;
                    default:
                        tooltiptext = ctrl.ControlName;
                        break;
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            #region Button
            if (ct == CtrlType.Button && IsVisible)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + command);
                if (!isFlowConditionReqired(ctrl.ControlName))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowNotDefine") + "')");
                }
                else if (!hasApplyOrAbort(ctrl.ControlName))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "ApplyFirst") + "')");
                }
                else
                {
                    if (ctrl.ControlName == "Add")
                    {
                        if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode)
                        {
                            string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null);
                            if (url != "")
                                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",toolbar=no,scrollbars,resizable');return false;");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Delete")
                    {
                        if (this.SureDelete)
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('sure to delete?')){" + "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command) + "}");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Submit" || ctrl.ControlName == "Approve" || ctrl.ControlName == "Return" || ctrl.ControlName == "Notify" || ctrl.ControlName == "Plus" || ctrl.ControlName == "Comment" || (ctrl.ControlName == "Pause" && this.OrganizationControl))
                    {
                        string script = GloScript(ctrl.ControlName);
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, script);
                    }
                    else if (ctrl.ControlName == "Apply" || ctrl.ControlName == "Ok" || ctrl.ControlName == "Update")
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command));
                        //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var start=new Date().getTime(); while(true) if(new Date().getTime()-start>5000) break; var aaa = document.getElementById('cmdApply');aaa.disabled=true;");
                        //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command));
                    }
                }
                // render Button tag
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; height:" + ((this.Height.Value <= 20) ? 25 : this.Height.Value) + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm
                if (!IsEnable)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Button);
                writer.Write(text);
                writer.RenderEndTag();
            }
            #endregion
            #region HyperLink
            else if (ct == CtrlType.HyperLink && IsVisible)
            {
                if (!isFlowConditionReqired(ctrl.ControlName))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowNotDefine") + "')");
                }
                else if (!hasApplyOrAbort(ctrl.ControlName))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "ApplyFirst") + "')");
                }
                else
                {
                    if (ctrl.ControlName == "Add")
                    {
                        if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode)
                        {
                            string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null);
                            if (url != "")
                                writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",toolbar=no,scrollbars,resizable');return false;");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Delete")
                    {
                        if (this.SureDelete)
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:if(confirm('sure to delete?')){" + csm.GetPostBackClientHyperlink(this, command) + "}");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Submit" || ctrl.ControlName == "Approve" || ctrl.ControlName == "Return" || ctrl.ControlName == "Notify" || ctrl.ControlName == "Plus" || ctrl.ControlName == "Comment" || (ctrl.ControlName == "Pause" && this.OrganizationControl))
                    {
                        string script = GloScript(ctrl.ControlName);
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + script + "}");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackEventReference(this, command));
                    }
                }
                // render Link tag
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm
                if (!IsEnable)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(text);
                writer.RenderEndTag();
            }
            #endregion
            #region Image
            else if (ct == CtrlType.Image && imageUrl != null && imageUrl != "" && IsVisible)
            {
                if (!isFlowConditionReqired(ctrl.ControlName))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowNotDefine") + "')");
                }
                else if (!hasApplyOrAbort(ctrl.ControlName))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "ApplyFirst") + "')");
                }
                else
                {
                    if (ctrl.ControlName == "Add")
                    {
                        if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode)
                        {
                            string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null);
                            if (url != "")
                                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",toolbar=no,scrollbars,resizable');return false;");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackClientHyperlink(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Delete")
                    {
                        if (this.SureDelete)
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('sure to delete?')){" + csm.GetPostBackEventReference(this, command) + "}");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Submit" || ctrl.ControlName == "Approve" || ctrl.ControlName == "Return" || ctrl.ControlName == "Notify" || ctrl.ControlName == "Plus" || ctrl.ControlName == "Comment" || (ctrl.ControlName == "Pause" && this.OrganizationControl))
                    {
                        string script = GloScript(ctrl.ControlName);

                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, script);
                    }
                    else if (ctrl.ControlName == "Reject")
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowRejectConfirm")
            + "')){" + csm.GetPostBackEventReference(this, command) + "}");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                    }
                }
                // render Image tag
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px;");
                if (!IsEnable)
                {
                    if (disenableImageUrl != null && disenableImageUrl != "")
                        writer.AddAttribute(HtmlTextWriterAttribute.Src, disenableImageUrl);
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl);
                        writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'");
                        writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'");
                    }
                    writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl);
                    writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'");
                    writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'");
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Alt, tooltiptext);// new add by ccm
                writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            #endregion
            writer.RenderEndTag(); // </td>
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + this.ControlsGap + "px;");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();
        }
예제 #2
0
        protected virtual void createButton(HtmlTextWriter writer, ControlItem ctrl, WebGridView gdView)
        {
            string command = "cmd" + ctrl.ControlName, text = ctrl.ControlText, imageUrl = ctrl.ImageUrl, mouseOverImageUrl = ctrl.MouseOverImageUrl, disenableImageUrl = ctrl.DisenableImageUrl;
            int size = ctrl.Size;
            bool IsVisible = ctrl.ControlVisible;
            bool IsEnable = this.DesignMode ? true : getUserSetEnabled(ctrl.ControlName, this.CurrentNavState);
            CtrlType ct = ctrl.ControlType;
            ClientScriptManager csm = Page.ClientScript;

            string tooltiptext = this.AddDefaultControls ? SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "WebNavigator", "ControlText", true) : SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "WebGridView", "ControlText", true);
            String sureDelete = SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "WebNavigator", "sureDeleteText", true);
            string[] arrtext = tooltiptext.Split(';');
            if (arrtext.Length == 6)
            {
                switch (ctrl.ControlName)
                {
                    case "Add":
                        if (this.GetServerText)
                        {
                            text = arrtext[0];
                            tooltiptext = arrtext[0];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Query":
                        if (this.GetServerText)
                        {
                            text = arrtext[1];
                            tooltiptext = arrtext[1];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Apply":
                        if (this.GetServerText)
                        {
                            text = arrtext[2];
                            tooltiptext = arrtext[2];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Abort":
                        if (this.GetServerText)
                        {
                            text = arrtext[3];
                            tooltiptext = arrtext[3];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "OK":
                        if (this.GetServerText)
                        {
                            text = arrtext[4];
                            tooltiptext = arrtext[4];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Cancel":
                        if (this.GetServerText)
                        {
                            text = arrtext[5];
                            tooltiptext = arrtext[5];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                }
            }
            else if (arrtext.Length >= 14)
            {
                switch (ctrl.ControlName)
                {
                    case "First":
                        if (this.GetServerText)
                        {
                            text = arrtext[0];
                            tooltiptext = arrtext[0];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Previous":
                        if (this.GetServerText)
                        {
                            text = arrtext[1];
                            tooltiptext = arrtext[1];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Next":
                        if (this.GetServerText)
                        {
                            text = arrtext[2];
                            tooltiptext = arrtext[2];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Last":
                        if (this.GetServerText)
                        {
                            text = arrtext[3];
                            tooltiptext = arrtext[3];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Add":
                        if (this.GetServerText)
                        {
                            text = arrtext[4];
                            tooltiptext = arrtext[4];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Update":
                        if (this.GetServerText)
                        {
                            text = arrtext[5];
                            tooltiptext = arrtext[5];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Delete":
                        if (this.GetServerText)
                        {
                            text = arrtext[6];
                            tooltiptext = arrtext[6];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "OK":
                        if (this.GetServerText)
                        {
                            text = arrtext[7];
                            tooltiptext = arrtext[7];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Cancel":
                        if (this.GetServerText)
                        {
                            text = arrtext[8];
                            tooltiptext = arrtext[8];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Apply":
                        if (this.GetServerText)
                        {
                            text = arrtext[9];
                            tooltiptext = arrtext[9];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Abort":
                        if (this.GetServerText)
                        {
                            text = arrtext[10];
                            tooltiptext = arrtext[10];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Query":
                        if (this.GetServerText)
                        {
                            text = arrtext[11];
                            tooltiptext = arrtext[11];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Print":
                        if (this.GetServerText)
                        {
                            text = arrtext[12];
                            tooltiptext = arrtext[12];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    case "Export":
                        if (this.GetServerText)
                        {
                            text = arrtext[13];
                            tooltiptext = arrtext[13];
                        }
                        else
                        {
                            text = ctrl.ControlText;
                            tooltiptext = ctrl.ControlName;
                        }
                        break;
                    default:
                        text = ctrl.ControlText;
                        tooltiptext = ctrl.ControlName;
                        break;
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if (ct == CtrlType.Button && IsVisible)
            {

                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + command);

                if (!IsEnable)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "return false;");
                }
                else
                {
                    if (ctrl.ControlName == "Add")
                    {
                        if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode)
                        {
                            string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null);
                            if (url != "")
                                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no');return false;");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command));
                            //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Delete")
                    {
                        if (this.SureDelete)
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('" + sureDelete + "')){" + "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command) + "}");
                        }
                        else
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command));
                        }
                    }
                    else if (ctrl.ControlName == "Apply" || ctrl.ControlName.ToLower() == "ok" || ctrl.ControlName == "Update")
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command));
                        //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var start=new Date().getTime(); while(true) if(new Date().getTime()-start>5000) break; var aaa = document.getElementById('cmdApply');aaa.disabled=true;");
                        //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                    }
                    // render Button tag
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; height:" + ((this.Height.Value <= 20) ? 25 : this.Height.Value) + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";");
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm
                    if (!IsEnable)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Button);
                    writer.Write(text);
                    writer.RenderEndTag();
                }
            }
            else if (ct == CtrlType.HyperLink && IsVisible)
            {
                if (ctrl.ControlName == "Add")
                {
                    if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode)
                    {
                        string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null);
                        if (url != "")
                            writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no');return false;");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command));
                    }
                }
                else if (ctrl.ControlName == "Delete")
                {
                    if (this.SureDelete)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:if(confirm('" + sureDelete + "')){" + csm.GetPostBackClientHyperlink(this, command) + "}");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command));
                    }
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackEventReference(this, command));
                }
                // render Link tag
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";");
                writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm
                if (!IsEnable)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.Write(text);
                writer.RenderEndTag();
            }
            else if (ct == CtrlType.Image && imageUrl != null && imageUrl != "" && IsVisible)
            {
                if (ctrl.ControlName == "Add")
                {
                    if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode)
                    {
                        string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null);
                        if (url != "")
                            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no');return false;");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackClientHyperlink(this, command));
                    }
                }
                else if (ctrl.ControlName == "Delete")
                {
                    if (this.SureDelete)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('" + sureDelete + "')){" + csm.GetPostBackEventReference(this, command) + "}");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                    }
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command));
                }
                // render Image tag
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px;");
                if (!IsEnable)
                {
                    if (disenableImageUrl != null && disenableImageUrl != "")
                        writer.AddAttribute(HtmlTextWriterAttribute.Src, disenableImageUrl);
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl);
                        writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'");
                        writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'");
                    }
                    writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl);
                    writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'");
                    writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'");
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Alt, tooltiptext);// new add by ccm
                writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
            }
            writer.RenderEndTag(); // </td>
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + this.ControlsGap + "px;");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();
        }