public CffTemplateField(CffGridViewColumnType _colType)
 {
     HorizontalAlignment   = HorizontalAlign.NotSet;
     ItemStyleWidth        = Unit.Percentage(100);
     ItemStyle.BorderColor = System.Drawing.Color.LightGray;  //todo: we should be able to set this outside
     IsReadOnly            = false;
     ColumnType            = _colType;
     this.ViewState.Add("ColumnType", _colType);   //add on custom init
 }
 public CffGenGridViewTemplate(CffGridViewColumnType theColumnType, string columnName,
                               string columnHeader = "", string colWidth = "100%",
                               string textCss      = "cffGGV_leftAlignedCell", bool readOnly = false)
 {
     DataField    = columnName;
     DataHeader   = columnHeader;
     ReadOnly     = readOnly;
     _columnType  = theColumnType;
     _columnWidth = colWidth;
     _textCss     = textCss;
 }
Beispiel #3
0
        /// <summary>
        /// Initialize Grid View Bound Hyper Link Template
        /// </summary>
        /// <param name="theColumnType">hyperlink</param>
        /// <param name="boundColumnText">display text</param>
        /// <param name="boundColumnValue">bound field name</param>
        /// <param name="hyperLinkFilterField">populate this column if you want to enable field filtering of hyperlink: format - "boundFilterField:boundFilterValue:on/off"</param>
        public GridViewBoundHyperLinkTemplate(CffGridViewColumnType theColumnType, string boundColumnText, string boundColumnValue, string hyperLinkFilterField = "", string cssStyle = "cffGGV_HyperLink")
        {
            string[] strArrayFilter = hyperLinkFilterField.Split(',');
            string[] strDummy       = hyperLinkFilterField.Split(':');

            DataField   = boundColumnValue;
            _columnType = theColumnType;

            _boundFilterField = strDummy[0];
            if (strDummy.Length > 1)
            {
                _boundFilterFieldValue = strDummy[1];
            }

            _onOff = false;
            if (strDummy.Length > 2)
            {
                _onOff = (strDummy[2].ToLower() == "on") ? true : false;
            }

            if (strDummy.Length > 3)
            {
                _isReversed = true;
            }
            else
            {
                _isReversed = false;
            }

            if (!string.IsNullOrEmpty(cssStyle))
            {
                _cssStyle = cssStyle;
            }

            DisplayField = boundColumnText;
            if (string.IsNullOrEmpty(boundColumnText))
            {
                DisplayField = DataField;
            }
        }
        public static string FormatDataColumn(CffGridViewColumnType colType, string Data)
        {
            string colData = Data;

            try
            {
                switch (colType)
                {
                case CffGridViewColumnType.Currency:
                    decimal value = Convert.ToDecimal(Data);
                    colData = String.Format("{0:C}", value);
                    break;

                case CffGridViewColumnType.Date:
                    System.DateTime dt = Convert.ToDateTime(Data);
                    colData = dt.ToString("dd/MM/yyyy");        // dt.ToString("mm/dd/yyyy"); //dbb
                    break;

                case CffGridViewColumnType.DateTime:
                    System.DateTime dttm = Convert.ToDateTime(Data);
                    colData = dttm.ToString("dd/MM/yyyy h:mm tt");          //dttm.ToString("mm/dd/yyyy H:mm:ss zzz");  //dbb

                    break;

                case CffGridViewColumnType.Text:
                    break;

                case CffGridViewColumnType.Memo:
                    colData = Data.Replace("<br />", " ");      //todo: for some reason the next line break in this field causes the grid to throw an exception; we replace next line with ' ' for now
                    break;

                default:
                    //todo :: add other data format handlers here
                    break;
                }
            }
            catch { }
            return(colData);
        }
 public GridViewDataTemplate(CffGridViewColumnType theColumnType, string columnName, string columnHeader = "", string colWidth = "100%",
                             string textCss = "cffGGV_leftAlignedCell", bool readOnly = false) :  base(theColumnType, columnName, columnHeader, colWidth, textCss, readOnly)
 {
 }
 public GridViewBooleanTemplate(CffGridViewColumnType theColumnType, string columnName, string columnHeader = "",
                                string colWidth = "100%", string textCss = "cffGGV_CellParagraph", bool readOnly = false) :
     base(theColumnType, columnName, columnHeader, colWidth, textCss, readOnly)
 {
 }