示例#1
0
 private static void CompressViewStateWithTelerik(GeneralDataPage BasePage, string OriginalViewState, string NewViewState)
 {
     // verifica se a compactação diminui o tamanho da viewstate
     // em pelo menos 10%, se não diminuir usa viewstate original
     if (NewViewState.Length > OriginalViewState.Length * 0.9)
     {
         BasePage.RegisterTelerikHiddenField("__NVIEWSTATE", OriginalViewState);
     }
     else
     {
         BasePage.RegisterTelerikHiddenField("__NVIEWSTATE", "1'" + NewViewState);
     }
 }
示例#2
0
 /// <summary>
 /// Arruma Texto dos group by por conta de colunas do tipo combobox
 /// </summary>
 /// <param name="Values">Valores de agrupamento</param>
 /// <param name="Grid">Grid a ser agrupado</param>
 /// <param name="Page">Pagina do grid</param>
 /// <returns></returns>
 public static string GridGroupByText(object Values, RadGrid Grid, GeneralDataPage Page)
 {
     if (Values is ListDictionary)
     {
         ListDictionary Val = (ListDictionary)Values;
         foreach (DictionaryEntry Item in Val)
         {
             if (Item.Value != null && Item.Key != null)
             {
                 GridColumn gc = Grid.Columns.FindByDataField(Item.Key.ToString());
                 if (!string.IsNullOrEmpty(gc.GroupByExpression))
                 {
                     return(gc.HeaderText + ": " + Page.DataProvider.PageProvider.GetGridComboText(Grid.ID + "_" + gc.UniqueName, Item.Value.ToString()));
                 }
                 else
                 {
                     return(gc.HeaderText + ": " + Item.Value.ToString());
                 }
             }
         }
     }
     return("");
 }
示例#3
0
 public static List <GeneralDataProviderItem> GetSelectedGridItems(RadGrid Grid, GeneralDataPage Page, Hashtable GridCheckedIds)
 {
     if (GridCheckedIds != null)
     {
         GeneralDataProviderItem GridItem = Page.GetGridProvider(Grid).GetDataProviderItem(Page.GetGridProvider(Grid).DataProvider);
         foreach (GridDataItem Itm in Grid.Items)
         {
             if (Itm.FindControl("CheckBox1") is CheckBox && (Itm.FindControl("CheckBox1") as CheckBox).Checked)
             {
                 GridCheckedIds[Itm.KeyValues] = true;
             }
             else
             {
                 GridCheckedIds.Remove(Itm.KeyValues);
             }
         }
         string filter = "";
         foreach (DictionaryEntry KeyValue in GridCheckedIds)
         {
             string FilterPart = "";
             if (KeyValue.Value is bool && (bool)KeyValue.Value)
             {
                 FilterPart = "(";
                 string[] Params = KeyValue.Key.ToString().TrimStart('{').TrimEnd('}').Split(',');
                 foreach (string keys in Params)
                 {
                     if (FilterPart != "(")
                     {
                         FilterPart += " and ";
                     }
                     string[] NameValue = keys.Split(':');
                     FilterPart += "[" + NameValue[0] + "] = " + Page.Dao.ToSql(NameValue[1].Trim('\"'), GridItem.Fields[NameValue[0]].FieldType);
                 }
                 FilterPart += ")";
             }
             if (FilterPart != "")
             {
                 if (filter != "")
                 {
                     filter += " or ";
                 }
                 filter += FilterPart;
             }
         }
         Page.GetGridProvider(Grid).DataProvider.FiltroAtual = filter;
     }
     return(Page.GetGridProvider(Grid).DataProvider.SelectAllItems(true));
 }