static protected grid_tmplcol createItem(page_cls page, string gridId, XmlNode colNode, string fieldName , TypeTemplateCol typeControl, int width, string colDes, string key = "", string icon = "", string page_url = "", bool open_url = false , string req_queries = "", string action = "", string demandid = "", string tooltipfld = "", string field_url = "") { return(new grid_tmplcol(page, gridId, colNode, ListItemType.Item, "", fieldName, typeControl , width, colDes, key, icon, page_url, open_url, req_queries, action, demandid, tooltipfld, field_url)); }
protected grid_tmplcol(page_cls page, string gridId, XmlNode colNode, ListItemType type, string colTitle, string fieldName , TypeTemplateCol typeControl, int width, string colDes = "", string key = "", string icon = "", string page_url = "", bool open_url = false , string requestQueries = "", string action = "", string demandid = "", string tooltipfld = "", string field_url = "") { _page = page; _grid_id = gridId; _colNode = colNode; _templateType = type; _col_title = colTitle; _fld_name = fieldName; _typeCtrl = typeControl; _width = width; _col_des = colDes; _key = key; _icon = icon; _page_url = page_url; _open_url = open_url; _demandid = demandid; _req_queries = requestQueries; _req_action = action; _field_title = tooltipfld; _field_url = field_url; }
static public void addToGrid(page_cls page, GridView gridData, XmlNode col) { string field = col.Attributes["field"].Value, tooltipfld = xmlDoc.node_val(col, "tooltipfld"), title = xmlDoc.node_val(col, "title", field) , type = xmlDoc.node_val(col, "type", "text"), des = xmlDoc.node_val(col, "des"); int widthCols = page.page.cfg_value_int("/root/gridsettings", "widthcols", -1), width = xmlDoc.node_int(col, "width", widthCols); bool hide_titles = page.page.cfg_value_bool("/root/gridsettings", "hideitem_tooltip", false); TypeTemplateCol typeCol = (TypeTemplateCol)Enum.Parse(typeof(TypeTemplateCol), type); if (typeCol == TypeTemplateCol.text || typeCol == TypeTemplateCol.check || typeCol == TypeTemplateCol.integer || typeCol == TypeTemplateCol.date || typeCol == TypeTemplateCol.date_hour || typeCol == TypeTemplateCol.link || typeCol == TypeTemplateCol.euro || typeCol == TypeTemplateCol.real) { TemplateField fieldTmpl = new TemplateField(); fieldTmpl.HeaderTemplate = createHeader(page, gridData.ID, col, title, field, typeCol, width, des); fieldTmpl.ItemTemplate = createItem(page, gridData.ID, col, field, typeCol, width, des, "", "", "", false, "", "", "", !hide_titles ? tooltipfld : ""); if (col.Attributes["summary"] != null) { fieldTmpl.FooterTemplate = createFooter(page, gridData.ID, col, title, field, typeCol, width, des); } if (width > 0) { fieldTmpl.HeaderStyle.Width = Unit.Pixel(width); fieldTmpl.ItemStyle.Width = Unit.Pixel(width); fieldTmpl.ItemStyle.CssClass = "item-tbl"; fieldTmpl.HeaderStyle.CssClass = "header-tbl"; } if (typeCol == TypeTemplateCol.check || typeCol == TypeTemplateCol.date || typeCol == TypeTemplateCol.date_hour) { fieldTmpl.ItemStyle.HorizontalAlign = HorizontalAlign.Center; } else if (typeCol == TypeTemplateCol.link) { fieldTmpl.ItemStyle.HorizontalAlign = HorizontalAlign.Left; } else if (typeCol == TypeTemplateCol.integer || typeCol == TypeTemplateCol.euro || typeCol == TypeTemplateCol.real) { fieldTmpl.ItemStyle.HorizontalAlign = HorizontalAlign.Right; if (fieldTmpl.FooterTemplate != null) { fieldTmpl.FooterStyle.HorizontalAlign = HorizontalAlign.Right; } } gridData.Columns.Add(fieldTmpl); } else { throw new Exception("Il tipo di campo '" + type + "' specificato per il campo '" + title + "' non รจ ancora supportato!"); } }
static protected grid_tmplcol createFooter(page_cls page, string gridId, XmlNode colNode, string colTitle, string fieldName , TypeTemplateCol typeControl, int width = -1, string colDes = "") { return(new grid_tmplcol(page, gridId, colNode, ListItemType.Footer, colTitle, fieldName, typeControl, width, colDes)); }