//删除功能页按钮点击事件
        protected void btnDel_Click(object sender, EventArgs e)
        {
            FineUI.CheckBoxField chkFild = (FineUI.CheckBoxField)GridFunctionPages.FindColumn("CheckBoxField1");
            SeatManage.ClassModel.SysFuncDicInfo modelSysFuncDicInfo = new SeatManage.ClassModel.SysFuncDicInfo();
            SeatManage.Bll.SysFuncDic            bllSysFuncDic       = new SeatManage.Bll.SysFuncDic();
            int selectCount = GridFunctionPages.SelectedRowIndexArray.Length;

            if (selectCount > 0)
            {
                for (int i = 0; i < selectCount; i++)
                {
                    int            rowIndex = GridFunctionPages.SelectedRowIndexArray[i];
                    FineUI.GridRow row      = GridFunctionPages.Rows[rowIndex] as FineUI.GridRow;
                    modelSysFuncDicInfo.No = row.DataKeys[0].ToString();
                    if (bllSysFuncDic.DeleteFuncPage(modelSysFuncDicInfo))
                    {
                        FineUI.Alert.ShowInTop("删除成功!");
                    }
                    else
                    {
                        FineUI.Alert.ShowInTop("删除失败!");
                    }
                }
                BindFunctionPagesGrid();
            }
        }
Ejemplo n.º 2
0
        //删除菜单按钮点击事件
        protected void btnDel_Click(object sender, EventArgs e)
        {
            FineUI.CheckBoxField chkFild = (FineUI.CheckBoxField)GridSysMenu.FindColumn("CheckBoxField1");
            SeatManage.ClassModel.SysMenuInfo modelSysMenuInfo = new SeatManage.ClassModel.SysMenuInfo();
            int selectCount = GridSysMenu.SelectedRowIndexArray.Length;

            if (selectCount > 0)
            {
                for (int i = 0; i < selectCount; i++)
                {
                    int            rowIndex = GridSysMenu.SelectedRowIndexArray[i];
                    FineUI.GridRow row      = GridSysMenu.Rows[rowIndex] as FineUI.GridRow;
                    modelSysMenuInfo.MenuID = int.Parse(row.DataKeys[0].ToString());
                    if (row.DataKeys[1].ToString() == "一级菜单")
                    {
                        List <SeatManage.ClassModel.SysMenuInfo> listSysMenu = SeatManage.Bll.SysMenu.GetMenusList();
                        foreach (SeatManage.ClassModel.SysMenuInfo selectmenu in listSysMenu)
                        {
                            if (selectmenu.MenuID == modelSysMenuInfo.MenuID)
                            {
                                modelSysMenuInfo = selectmenu;
                                break;
                            }
                        }
                        foreach (SeatManage.ClassModel.SysMenuInfo childmenu in modelSysMenuInfo.ChildMenu)
                        {
                            if (!SeatManage.Bll.SysMenu.DeleteMenus(childmenu))
                            {
                                FineUI.Alert.ShowInTop("删除子菜单失败!");
                                BindSysMenu();
                                return;
                            }
                        }
                        if (SeatManage.Bll.SysMenu.DeleteMenus(modelSysMenuInfo))
                        {
                            FineUI.Alert.ShowInTop("删除成功!");
                            BindSysMenu();
                        }
                        else
                        {
                            FineUI.Alert.ShowInTop("删除失败!");
                            BindSysMenu();
                        }
                    }
                    else
                    {
                        if (SeatManage.Bll.SysMenu.DeleteMenus(modelSysMenuInfo))
                        {
                            FineUI.Alert.ShowInTop("删除成功!");
                        }
                        else
                        {
                            FineUI.Alert.ShowInTop("删除失败!");
                        }
                    }
                }
                BindSysMenu();
            }
        }
Ejemplo n.º 3
0
        internal override object GetColumnValue(GridRow row)
        {
            bool isChecked = false;

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

                if (value == null || value == DBNull.Value || (value is String && String.IsNullOrEmpty(value.ToString())))
                {
                    // 不做处理
                }
                else
                {
                    isChecked = Convert.ToBoolean(value);
                }
            }

            return isChecked;
        }
Ejemplo n.º 4
0
        internal override string GetColumnValue(GridRow row)
        {
            string text = String.Empty;

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

                if (value == null)
                {
                    text = "false";
                }
                else
                {
                    text = value.ToString().ToLower();
                }
            }

            return text;
        }
Ejemplo n.º 5
0
        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);
                        if (HtmlEncodeFormatString)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                    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;
        }
Ejemplo n.º 6
0
        internal override string GetColumnValue(GridRow row)
        {
            string text = String.Empty;

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

                if (value == null)
                {
                    text = NullDisplayText;
                }
                else
                {
                    if (!String.IsNullOrEmpty(DataFormatString))
                    {
                        text = String.Format(DataFormatString, value);
                        if (HtmlEncodeFormatString)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                    else
                    {
                        text = value.ToString();
                        if (HtmlEncode)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                }
            }

            HtmlNodeBuilder nb = new HtmlNodeBuilder("span");

            nb.InnerProperty = text;

            if (!Enabled)
            {
                nb.SetProperty("class", "x-item-disabled");
                nb.SetProperty("disabled", "disabled");
            }

            string result = nb.ToString();

            string tooltip = GetTooltipString(row);
            if (!String.IsNullOrEmpty(tooltip))
            {
                result = result.ToString().Insert("<span".Length, tooltip);
            }

            // �������� <span>�󶨵�����</span>
            if (result.StartsWith("<span>"))
            {
                result = result.Substring("<span>".Length, result.Length - "<span></span>".Length);
            }

            return result;
        }
Ejemplo n.º 7
0
        internal override string GetColumnValue(GridRow row)
        {
            HtmlNodeBuilder nb = new HtmlNodeBuilder("a");

            #region DataTextField

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

                string text = String.Empty;
                if (value != null)
                {
                    if (!String.IsNullOrEmpty(DataTextFormatString))
                    {
                        text = String.Format(DataTextFormatString, value);
                        if (HtmlEncodeFormatString)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                    else
                    {
                        text = value.ToString();
                        if (HtmlEncode)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                }

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

            #endregion

            if (Enabled)
            {
                #region DataNavigateUrlFields

                string hrefOriginal = String.Empty;

                if (DataNavigateUrlFields != null && DataNavigateUrlFields.Length > 0)
                {
                    //string[] fields = DataNavigateUrlFields.Trim().TrimEnd(',').Split(',');
                    string[] fields = DataNavigateUrlFields;

                    List<object> fieldValues = new List<object>();
                    foreach (string field in fields)
                    {
                        if (!String.IsNullOrEmpty(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(DataNavigateUrlFormatString))
                    {
                        hrefOriginal = String.Format(DataNavigateUrlFormatString, fieldValues.ToArray());
                    }
                    else
                    {
                        if (fieldValues.Count > 0)
                        {
                            hrefOriginal = fieldValues[0].ToString();
                        }
                    }
                }
                else
                {
                    hrefOriginal = NavigateUrl;
                }

                nb.SetProperty("href", Grid.ResolveUrl(hrefOriginal));

                #endregion

                #region Target

                if (!String.IsNullOrEmpty(Target))
                {
                    nb.SetProperty("target", Target);
                }
                else
                {
                    nb.SetProperty("target", "_blank");
                }

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

            //string result2 = nb.ToString();

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

            //return result2;

            string result = nb.ToString();

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

            return result;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// ȡ������Ⱦ���HTML
 /// </summary>
 /// <param name="row">�����ʵ��</param>
 /// <returns>��Ⱦ���HTML</returns>
 internal virtual string GetColumnValue(GridRow row)
 {
     return String.Empty;
 }
Ejemplo n.º 9
0
        internal override string GetColumnValue(GridRow row)
        {
            //string result = String.Empty;

            #region DataTextField

            string text = String.Empty;

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

                if (!String.IsNullOrEmpty(DataTextFormatString))
                {
                    text = String.Format(DataTextFormatString, value);
                    if (HtmlEncodeFormatString)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }
                else
                {
                    text = value.ToString();
                    if (HtmlEncode)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }
            }
            else
            {
                text = Text;
            }

            #endregion

            HtmlNodeBuilder nb;

            #region Enabled

            nb = new HtmlNodeBuilder("a");

            if (Enabled)
            {
                nb.SetProperty("href", "javascript:;");

                // click
                string paramStr = String.Format("Command${0}${1}${2}${3}", row.RowIndex, ColumnIndex, CommandName.Replace("'", "\""), CommandArgument.Replace("'", "\""));
                string postBackReference = Grid.GetPostBackEventReference(paramStr);

                string clientScript = Button.ResolveClientScript(ValidateForms, ValidateTarget, ValidateMessageBox, EnablePostBack, postBackReference,
                  ConfirmText, ConfirmTitle, ConfirmIcon, ConfirmTarget, OnClientClick, String.Empty);

                clientScript = JsHelper.GetDeferScript(clientScript, 0) + "X.util.stopEventPropagation.apply(null, arguments);";

                nb.SetProperty("onclick", clientScript);

                //result = nb.ToString();
            }
            else
            {
                nb.SetProperty("class", "x-item-disabled");
                nb.SetProperty("disabled", "disabled");

                //nb = new HtmlNodeBuilder("span");
                //nb.SetProperty("class", "gray");
                //nb.InnerProperty = text;
                //result = String.Format("<span class=\"gray\">{0}</span>", text);
            }

            nb.InnerProperty = text;

            #endregion

            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 result = nb.ToString();
            //#region Tooltip

            //if (!String.IsNullOrEmpty(tooltip))
            //{
            //    if (result.StartsWith("<a "))
            //    {
            //        result = result.ToString().Insert(2, tooltip);
            //    }
            //    else if (result.StartsWith("<span "))
            //    {
            //        result = result.ToString().Insert(5, tooltip);
            //    }
            //}

            //#endregion

            //return result;

            string result = nb.ToString();

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

            return result;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// ȡ�õ�Ԫ�������
        /// </summary>
        /// <param name="row"></param>
        /// <param name="checkState"></param>
        /// <returns></returns>
        private string GetColumnValue(GridRow row, bool checkState)
        {
            string result = String.Empty;

            if (!String.IsNullOrEmpty(DataField))
            {
                string textAlignClass = String.Empty;
                if (TextAlign != TextAlign.Left)
                {
                    textAlignClass = "box-grid-checkbox-" + TextAlignName.GetName(TextAlign);
                }

                if (RenderAsStaticField)
                {
                    if (checkState)
                    {
                        result = "<div class=\"box-grid-static-checkbox " + textAlignClass + "\"></div>";
                    }
                    else
                    {
                        result = "<div class=\"box-grid-static-checkbox box-grid-static-checkbox-unchecked " + textAlignClass + "\"></div>";
                    }
                }
                else
                {
                    string paramStr = String.Format("Command${0}${1}${2}${3}", row.RowIndex, ColumnIndex, CommandName.Replace("'", "\""), CommandArgument.Replace("'", "\""));
                    // �ӳ�ִ��
                    string postBackReference = JsHelper.GetDeferScript(Grid.GetPostBackEventReference(paramStr), 0);

                    // string onClickScript = String.Format("{0}_checkbox{1}(event,this,{2});", Grid.XID, ColumnIndex, row.RowIndex);
                    string onClickScript = "Ext.get(this).toggleClass('box-grid-checkbox-unchecked');";
                    if (!ShowHeaderCheckBox && AutoPostBack)
                    {
                        onClickScript += postBackReference;
                    }

                    onClickScript += "X.util.stopEventPropagation.apply(null, arguments);";

                    if (checkState)
                    {
                        if (Enabled)
                        {
                            result = String.Format("<div class=\"box-grid-checkbox {0}\" onclick=\"{1}\"></div>", textAlignClass, onClickScript);
                        }
                        else
                        {
                            result = String.Format("<div class=\"box-grid-checkbox box-grid-checkbox-disabled {0}\"></div>", textAlignClass);
                        }
                    }
                    else
                    {
                        if (Enabled)
                        {
                            result = String.Format("<div class=\"box-grid-checkbox box-grid-checkbox-unchecked {0}\" onclick=\"{1}\"></div>", textAlignClass, onClickScript);
                        }
                        else
                        {
                            result = String.Format("<div class=\"box-grid-checkbox box-grid-checkbox-disabled box-grid-checkbox-unchecked-disabled {0}\"></div>", textAlignClass);
                        }
                    }
                }
            }

            return result;
        }
Ejemplo n.º 11
0
        internal override string GetColumnValue(GridRow row)
        {
            string text = String.Empty;

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

                if (value == null)
                {
                    text = NullDisplayText;
                }
                else
                {
                    if (FieldType == FieldType.Boolean)
                    {
                        text = value.ToString().ToLower();
                    }
                    else if (FieldType == FieldType.Date)
                    {
                        // http://www.dotnetperls.com/datetime-format
                        DateTime date = DateTime.Now;
                        if (value.GetType() == typeof(DateTime))
                        {
                            date = (DateTime)value;
                        }
                        else
                        {
                            date = DateTime.Parse(value.ToString());
                        }

                        // 2009-02-27T12:12:22
                        text = date.ToString("s");
                        int tIndex = text.IndexOf("T");
                        if (tIndex >= 0)
                        {
                            text = text.Substring(0, tIndex) + "T00:00:00";
                        }

                        //text = date.ToString(RendererArgument);
                    }
                    else
                    {
                        text = value.ToString();
                    }

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

            return text;
        }
Ejemplo n.º 12
0
        internal override string GetColumnValue(GridRow row)
        {
            //string result = String.Empty;

            #region DataTextField

            string text = String.Empty;

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

                if (!String.IsNullOrEmpty(DataTextFormatString))
                {
                    text = String.Format(DataTextFormatString, value);
                    if (HtmlEncodeFormatString)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }
                else
                {
                    text = value.ToString();
                    if (HtmlEncode)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }
            }
            else
            {
                text = Text;
            }

            #endregion

            HtmlNodeBuilder nb;

            #region Enabled

            nb = new HtmlNodeBuilder("a");

            if (Enabled)
            {
                nb.SetProperty("href", "javascript:;");

                // click
                string paramStr          = String.Format("Command${0}${1}${2}${3}", row.RowIndex, ColumnIndex, CommandName.Replace("'", "\""), CommandArgument.Replace("'", "\""));
                string postBackReference = Grid.GetPostBackEventReference(paramStr);

                string clientScript = Button.ResolveClientScript(ValidateForms, ValidateTarget, ValidateMessageBox, EnablePostBack, postBackReference,
                                                                 ConfirmText, ConfirmTitle, ConfirmIcon, ConfirmTarget, OnClientClick, String.Empty);

                clientScript = JsHelper.GetDeferScript(clientScript, 0) + "X.util.stopEventPropagation.apply(null, arguments);";

                nb.SetProperty("onclick", clientScript);

                //result = nb.ToString();
            }
            else
            {
                nb.SetProperty("class", "x-item-disabled");
                nb.SetProperty("disabled", "disabled");

                //nb = new HtmlNodeBuilder("span");
                //nb.SetProperty("class", "gray");
                //nb.InnerProperty = text;
                //result = String.Format("<span class=\"gray\">{0}</span>", text);
            }

            nb.InnerProperty = text;

            #endregion

            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 result = nb.ToString();
            //#region Tooltip

            //if (!String.IsNullOrEmpty(tooltip))
            //{
            //    if (result.StartsWith("<a "))
            //    {
            //        result = result.ToString().Insert(2, tooltip);
            //    }
            //    else if (result.StartsWith("<span "))
            //    {
            //        result = result.ToString().Insert(5, tooltip);
            //    }
            //}

            //#endregion

            //return result;

            string result = nb.ToString();

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

            return(result);
        }
Ejemplo n.º 13
0
        internal override string GetColumnValue(GridRow row)
        {
            GridRowControl control = row.TemplateContainers[ColumnIndex];

            return String.Format("#@TPL@#{0}", control.ClientID);
            //return String.Format("<div id=\"{0}_container\"></div>", control.ClientID);
            //string result = String.Empty;

            //if (_itemTemplate != null)
            //{
            //    StringBuilder output = new StringBuilder();
            //    using (StringWriter sw = new StringWriter(output, CultureInfo.CurrentCulture))
            //    {
            //        using (HtmlTextWriter htw = new HtmlTextWriter(sw))
            //        {
            //            //using (GridRowControl control = new GridRowControl(row.DataItem, row.RowIndex))
            //            //{
            //            //    _itemTemplate.InstantiateIn(control);
            //            //    control.ID = String.Format("{0}_{1}", Grid.ID, row.RowIndex);
            //            //    control.DataBind();

            //            //    control.RenderControl(htw);

            //            //}
            //            //GridRowControl control = row.TemplateContainers[ColumnIndex];
            //            //if (control != null)
            //            //{
            //            //    control.DataBind();
            //            //    //control.RenderControl(htw);
            //            //}
            //        }
            //    }

            //    result = output.ToString();
            //}

            //return result;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// ȡ����ʾ�ַ���
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        protected string GetTooltipString(GridRow row)
        {
            string result = null;

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

                if (!String.IsNullOrEmpty(DataToolTipFormatString))
                {
                    result = String.Format(DataToolTipFormatString, value);
                }
                else
                {
                    result = value.ToString();
                }
            }
            else if(!String.IsNullOrEmpty(ToolTip))
            {
                result = ToolTip;
            }

            return result == null ? "" : String.Format(" ext:qtip=\"{0}\" ", result);
            //return String.IsNullOrEmpty(result) ? String.Empty : result;
        }
Ejemplo n.º 15
0
        internal override string GetColumnValue(GridRow row)
        {
            string text = String.Empty;

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

                if (value == null)
                {
                    text = NullDisplayText;
                }
                else
                {
                    if (!String.IsNullOrEmpty(DataFormatString))
                    {
                        text = String.Format(DataFormatString, value);
                        if (HtmlEncodeFormatString)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                    else
                    {
                        text = value.ToString();
                        if (HtmlEncode)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                }
            }

            HtmlNodeBuilder nb = new HtmlNodeBuilder("span");

            nb.InnerProperty = text;

            if (!Enabled)
            {
                nb.SetProperty("class", "x-item-disabled");
                nb.SetProperty("disabled", "disabled");
            }


            string result = nb.ToString();

            string tooltip = GetTooltipString(row);

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

            // 如果结果是 <span>绑定的数据</span>
            if (result.StartsWith("<span>"))
            {
                result = result.Substring("<span>".Length, result.Length - "<span></span>".Length);
            }

            return(result);
        }
Ejemplo n.º 16
0
        internal override string 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 (!String.IsNullOrEmpty(DataTextFormatString))
                {
                    text = String.Format(DataTextFormatString, value);
                    if (HtmlEncodeFormatString)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }
                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));
                            string fieldValue = row.GetPropertyValue(field).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 (!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);
        }
Ejemplo n.º 17
0
 /// <summary>
 /// 取得列渲染后的HTML
 /// </summary>
 /// <param name="row">表格行实例</param>
 /// <returns>渲染后的HTML</returns>
 internal virtual string GetColumnValue(GridRow row)
 {
     return(String.Empty);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// 取得单元格的数据
        /// </summary>
        /// <param name="row"></param>
        /// <param name="checkState"></param>
        /// <returns></returns>
        private string GetColumnValue(GridRow row, bool checkState)
        {
            string result = String.Empty;

            if (!String.IsNullOrEmpty(DataField))
            {
                string textAlignClass = String.Empty;
                if (TextAlign != TextAlign.Left)
                {
                    textAlignClass = "align-" + TextAlignName.GetName(TextAlign);
                }

                if (RenderAsStaticField)
                {
                    if (checkState)
                    {
                        result = "<div class=\"box-grid-static-checkbox " + textAlignClass + "\"></div>";
                    }
                    else
                    {
                        result = "<div class=\"box-grid-static-checkbox unchecked " + textAlignClass + "\"></div>";
                    }
                }
                else
                {
                    string paramStr = String.Format("Command${0}${1}${2}${3}", row.RowIndex, ColumnIndex, CommandName.Replace("'", "\""), CommandArgument.Replace("'", "\""));

                    // 延迟执行,确保当前复选框的状态已经改变
                    string postBackReference = JsHelper.GetDeferScript(Grid.GetPostBackEventReference(paramStr), 0);

                    // string onClickScript = String.Format("{0}_checkbox{1}(event,this,{2});", Grid.XID, ColumnIndex, row.RowIndex);
                    //string onClickScript = "Ext.get(this).toggleClass('unchecked');";
                    string onClickScript = "X.toggle(this,'unchecked');";
                    if (!ShowHeaderCheckBox && AutoPostBack)
                    {
                        onClickScript += postBackReference;
                    }

                    //onClickScript += "X.stop();";

                    if (checkState)
                    {
                        if (Enabled)
                        {
                            result = String.Format("<div class=\"box-grid-checkbox {0}\" onclick=\"{1}\"></div>", textAlignClass, onClickScript);
                        }
                        else
                        {
                            result = String.Format("<div class=\"box-grid-checkbox disabled {0}\"></div>", textAlignClass);
                        }
                    }
                    else
                    {
                        if (Enabled)
                        {
                            result = String.Format("<div class=\"box-grid-checkbox unchecked {0}\" onclick=\"{1}\"></div>", textAlignClass, onClickScript);
                        }
                        else
                        {
                            result = String.Format("<div class=\"box-grid-checkbox unchecked disabled {0}\"></div>", textAlignClass);
                        }
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 获取列的状态
 /// </summary>
 /// <param name="row"></param>
 /// <returns></returns>
 internal virtual object GetColumnState(GridRow row)
 {
     return(null);
 }
Ejemplo n.º 20
0
        /// <summary>
        /// 本行的复选框是否处于选中状态
        /// </summary>
        /// <param name="rowIndex">行索引</param>
        /// <returns>选中状态</returns>
        public bool GetCheckedState(int rowIndex)
        {
            GridRow row = this.Grid.Rows[rowIndex];

            return(Convert.ToBoolean(row.States[ColumnIndex]));
        }
Ejemplo n.º 21
0
 internal override string GetColumnValue(GridRow row)
 {
     return(String.Empty);
 }
Ejemplo n.º 22
0
 internal override string GetColumnValue(GridRow row)
 {
     return String.Empty;
 }
Ejemplo n.º 23
0
        internal override string GetColumnValue(GridRow row)
        {
            HtmlNodeBuilder nb = new HtmlNodeBuilder("a");

            #region DataTextField

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

                string text = String.Empty;
                if (!String.IsNullOrEmpty(DataTextFormatString))
                {
                    text = String.Format(DataTextFormatString, value);
                    if (HtmlEncodeFormatString)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }
                else
                {
                    text = value.ToString();
                    if (HtmlEncode)
                    {
                        text = HttpUtility.HtmlEncode(text);
                    }
                }

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

            #endregion

            if (Enabled)
            {
                #region DataNavigateUrlFields

                string hrefOriginal = String.Empty;

                if (DataNavigateUrlFields != null && DataNavigateUrlFields.Length > 0)
                {
                    //string[] fields = DataNavigateUrlFields.Trim().TrimEnd(',').Split(',');
                    string[] fields = DataNavigateUrlFields;

                    List <object> fieldValues = new List <object>();
                    foreach (string field in fields)
                    {
                        if (!String.IsNullOrEmpty(field))
                        {
                            string fieldValue = row.GetPropertyValue(field).ToString();
                            if (UrlEncode)
                            {
                                fieldValue = HttpUtility.UrlEncode(fieldValue);
                            }
                            fieldValues.Add(fieldValue);
                        }
                    }

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

                nb.SetProperty("href", Grid.ResolveUrl(hrefOriginal));

                #endregion

                #region Target

                if (!String.IsNullOrEmpty(Target))
                {
                    nb.SetProperty("target", Target);
                }
                else
                {
                    nb.SetProperty("target", "_blank");
                }

                #endregion

                nb.SetProperty("onclick", "X.util.stopEventPropagation.apply(null, arguments);");
            }
            else
            {
                nb.SetProperty("class", "x-item-disabled");
                nb.SetProperty("disabled", "disabled");
            }

            //string result2 = nb.ToString();

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


            //return result2;

            string result = nb.ToString();

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

            return(result);
        }
Ejemplo n.º 24
0
        internal override string GetColumnValue(GridRow row)
        {
            string result = String.Empty;

            if (!String.IsNullOrEmpty(DataImageUrlField))
            {
                object value = row.GetPropertyValue(DataImageUrlField);
                string imageUrl = String.Empty;

                if (value != null)
                {
                    if (!String.IsNullOrEmpty(DataImageUrlFormatString))
                    {
                        imageUrl = String.Format(DataImageUrlFormatString, value);
                    }
                    else
                    {
                        imageUrl = value.ToString();
                    }
                }

                string cssStyle = String.Empty;

                if (ImageWidth != Unit.Empty)
                {
                    cssStyle += String.Format("width:{0}px;", ImageWidth.Value);
                }
                if (ImageHeight != Unit.Empty)
                {
                    cssStyle += String.Format("height:{0}px;", ImageHeight.Value);
                }

                if (!String.IsNullOrEmpty(cssStyle))
                {
                    cssStyle = String.Format(" style=\"{0}\"", cssStyle);
                }

                result = String.Format("<img src=\"{0}\" class=\"f-grid-imagefield\"{1}/>",
                    Grid.ResolveUrl(imageUrl),
                    cssStyle);
            }

            string tooltip = GetTooltipString(row);
            if (!String.IsNullOrEmpty(tooltip))
            {
                result = result.ToString().Insert(4, tooltip);
            }

            return result;
        }
Ejemplo n.º 25
0
        internal override object GetColumnValue(GridRow row)
        {
            string text = String.Empty;

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

                if (value == null || value == DBNull.Value || (value is String && String.IsNullOrEmpty(value.ToString())))
                {
                    text = NullDisplayText;
                }
                // add by wz
                else if (DataType == GridColumnDataType.Boolean || DataType == GridColumnDataType.Number)
                {
                    return value;
                }
                else
                {
                    if (!String.IsNullOrEmpty(DataFormatString))
                    {
                        text = String.Format(DataFormatString, value);
                        if (HtmlEncodeFormatString)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                    else
                    {
                        text = value.ToString();
                        if (HtmlEncode)
                        {
                            text = HttpUtility.HtmlEncode(text);
                        }
                    }
                }
            }

            HtmlNodeBuilder nb = new HtmlNodeBuilder("span");

            nb.InnerProperty = text;

            if (!Enabled)
            {
                nb.SetProperty("class", "x-item-disabled");
                nb.SetProperty("disabled", "disabled");
            }


            string result = nb.ToString();

            string tooltip = GetTooltipString(row);
            if (!String.IsNullOrEmpty(tooltip))
            {
                result = result.ToString().Insert("<span".Length, tooltip);
            }

            // 如果结果是 <span>绑定的数据</span>
            if (result.StartsWith("<span>"))
            {
                result = result.Substring("<span>".Length, result.Length - "<span></span>".Length);
            }

            return result;
        }
Ejemplo n.º 26
0
 /// <summary>
 /// ��ȡ�е�״̬
 /// </summary>
 /// <param name="row"></param>
 /// <returns></returns>
 internal virtual object GetColumnState(GridRow row)
 {
     return null;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="row">行</param>
 public GridRowEventArgs(GridRow row)
 {
     _row = row;
 }
Ejemplo n.º 28
0
        internal override object GetColumnValue(GridRow row)
        {
            object result = String.Empty;

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

                if (value == null || value == DBNull.Value || (value is String && String.IsNullOrEmpty(value.ToString())))
                {
                    result = NullDisplayText;
                }
                else
                {
                    if (FieldType == FieldType.Boolean)
                    {
                        result = Convert.ToBoolean(value);
                    }
                    else if (FieldType == FieldType.Int)
                    {
                        result = Convert.ToInt32(value);
                    }
                    else if (FieldType == FieldType.Float)
                    {
                        result = Convert.ToSingle(value);
                    }
                    else if (FieldType == FieldType.Double)
                    {
                        result = Convert.ToDouble(value);
                    }
                    else if (FieldType == FieldType.Date)
                    {
                        // http://www.dotnetperls.com/datetime-format
                        DateTime date = DateTime.Now;
                        if (value.GetType() == typeof(DateTime))
                        {
                            date = (DateTime)value;
                        }
                        else
                        {
                            date = DateTime.Parse(value.ToString());
                        }

                        //// 2009-02-27T12:12:22
                        //text = date.ToString("s");
                        //int tIndex = text.IndexOf("T");
                        //if (tIndex >= 0)
                        //{
                        //    text = text.Substring(0, tIndex) + "T00:00:00";
                        //}

                        result = date.ToString(RendererArgument);
                    }
                    else
                    {
                        result = value.ToString();

                        if (HtmlEncode)
                        {
                            result = HttpUtility.HtmlEncode(result.ToString());
                        }
                    }
                }
            }

            return result;
        }
Ejemplo n.º 29
0
 internal override object GetColumnState(GridRow row)
 {
     if (row.DataItem == null)
     {
         return row.States[ColumnIndex];
     }
     else
     {
         return row.GetPropertyValue(DataField);
     }
 }
Ejemplo n.º 30
0
        private void DataBindRow(int rowIndex, object rowObj)
        {
            GridRow row = new GridRow(this, rowObj, rowIndex);
            Rows.Add(row);
            Controls.Add(row);
            row.InitTemplateContainers();

            OnPreRowDataBound(new GridPreRowEventArgs(rowObj, rowIndex));

            //row.DataBindRow();
            row.DataBind();

            OnRowDataBound(new GridRowEventArgs(rowObj, rowIndex, row.Values));
        }
Ejemplo n.º 31
0
        internal override string GetColumnValue(GridRow row)
        {
            string result = String.Empty;

            bool checkState = Convert.ToBoolean(GetColumnState(row));

            result = GetColumnValue(row, checkState);

            string tooltip = GetTooltipString(row);
            if (!String.IsNullOrEmpty(tooltip))
            {
                result = result.ToString().Insert("<img".Length, tooltip);
            }

            return result;
        }
Ejemplo n.º 32
0
        private void DataBindRow(int rowIndex, object rowObj)
        {
            GridPreRowEventArgs preArgs = new GridPreRowEventArgs(rowObj, rowIndex);
            OnPreRowDataBound(preArgs);

            // 事件处理函数要求取消添加本节点
            if (!preArgs.Cancelled)
            {

                GridRow row = new GridRow(this, rowObj, rowIndex);
                Rows.Add(row);
                //Controls.Add(row);
                row.InitTemplateContainers();

                //row.DataBindRow();
                row.DataBindRow();

                OnRowDataBound(new GridRowEventArgs(row));
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// ȡ�õ�Ԫ�������
        /// </summary>
        /// <param name="row"></param>
        /// <param name="checkState"></param>
        /// <returns></returns>
        private string GetColumnValue(GridRow row, bool checkState)
        {
            string result = String.Empty;
            string emptyImageUrl = Grid.ResolveUrl(ResourceHelper.GetEmptyImageUrl());

            if (!String.IsNullOrEmpty(DataField))
            {
                //string textAlignClass = String.Empty;
                //if (TextAlign != TextAlign.Left)
                //{
                //    textAlignClass = "align-" + TextAlignName.GetName(TextAlign);
                //}

                if (RenderAsStaticField)
                {
                    if (checkState)
                    {
                        result = String.Format("<img class=\"f-grid-static-checkbox\" src=\"{0}\"/>", emptyImageUrl);
                    }
                    else
                    {
                        result = String.Format("<img class=\"f-grid-static-checkbox unchecked\" src=\"{0}\"/>", emptyImageUrl);
                    }
                }
                else
                {
                    string paramStr = String.Format("Command${0}${1}${2}${3}", row.RowIndex, ColumnIndex, CommandName.Replace("'", "\""), CommandArgument.Replace("'", "\""));

                    // �ӳ�ִ�У�ȷ����ǰ��ѡ���״̬�Ѿ��ı�
                    string postBackReference = JsHelper.GetDeferScript(Grid.GetPostBackEventReference(paramStr), 0);

                    // string onClickScript = String.Format("{0}_checkbox{1}(event,this,{2});", Grid.XID, ColumnIndex, row.RowIndex);
                    //string onClickScript = "Ext.get(this).toggleClass('unchecked');";
                    string onClickScript = "F.toggle(this,'unchecked');";
                    if (!ShowHeaderCheckBox && AutoPostBack)
                    {
                        onClickScript += postBackReference;
                    }

                    //onClickScript += "F.stop();";

                    if (checkState)
                    {
                        if (Enabled)
                        {
                            result = String.Format("<img class=\"f-grid-checkbox\" src=\"{0}\" onclick=\"{1}\"/>", emptyImageUrl, onClickScript);
                        }
                        else
                        {
                            result = String.Format("<img class=\"f-grid-checkbox disabled\" src=\"{0}\"/>", emptyImageUrl);
                        }
                    }
                    else
                    {
                        if (Enabled)
                        {
                            result = String.Format("<img class=\"f-grid-checkbox unchecked\" src=\"{0}\" onclick=\"{1}\"/>", emptyImageUrl, onClickScript);
                        }
                        else
                        {
                            result = String.Format("<img class=\"f-grid-checkbox unchecked disabled\" src=\"{0}\"/>", emptyImageUrl);
                        }
                    }
                }
            }

            return result;
        }
Ejemplo n.º 34
0
 internal override object GetColumnValue(GridRow row)
 {
     GridTemplateContainer control = row.TemplateContainers[ColumnIndex];
     
     return String.Format("{0}{1}", Grid.TEMPLATE_PLACEHOLDER_PREFIX, control.ID);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="row">行</param>
 public GridRowEventArgs(GridRow row)
 {
     _row = row;
 }