Hi!
I have a RadGrid with some data. I group this data for some criteria (I call, p.e., tableori).
The trouble is when I try to change the message at GroupHeader. When I try to sort the grid or paging it, I have the exception "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive"; but if I comment the lines inside the if otpion of GridGroupHeaderItem works fine.
Any ideas or suggestions to skip this problem?
I have a RadGrid with some data. I group this data for some criteria (I call, p.e., tableori).
| GridGroupByExpression expression = new GridGroupByExpression(); |
| GridGroupByField gridGroupByField = new GridGroupByField(); |
| //Add select fields (before the "Group By" clause) - Campo de ruptura |
| gridGroupByField = new GridGroupByField(); |
| gridGroupByField.FieldName = "tableori"; |
| gridGroupByField.FormatString = "<strong>{0}</strong>"; |
| expression.SelectFields.Add(gridGroupByField); |
| //Add a field for group-by (after the "Group By" clause) - Agrupación |
| gridGroupByField = new GridGroupByField(); |
| gridGroupByField.FieldName "tableori"; |
| expression.GroupByFields.Add(gridGroupByField); |
| assigGrid.MasterTableView.GroupByExpressions.Add(expression); |
| assigGrid.MasterTableView.ShowGroupFooter = true; |
The trouble is when I try to change the message at GroupHeader. When I try to sort the grid or paging it, I have the exception "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive"; but if I comment the lines inside the if otpion of GridGroupHeaderItem works fine.
| protected void assigGrid_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| try |
| { |
| if (defObjeto == null) |
| { |
| objeto = Request.QueryString["obj"]; |
| idioma = UtilControlSession.GetIdioma(Session); |
| wc = new WebCache(Cache, (string)Session[Constantes.SESS_APLICACION_ACTIVA], bdConnStr); |
| defObjeto = wc.GetObjetoAsignacionH(objeto, idioma); |
| } |
| if (e.Item is GridGroupHeaderItem) |
| { |
| GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item; |
| // Los datos que afectan a esta agrupación (criterio(s) de agrupación y subtotales si los hubiere) |
| DataRowView groupDataRow = (DataRowView)e.Item.DataItem; |
| int colSpan = item.Cells[1].ColumnSpan; |
| item.Cells.RemoveAt(1); |
| TableCell tc = new TableCell(); |
| tc.ColumnSpan = colSpan; |
| tc.HorizontalAlign = HorizontalAlign.Left; |
| tc.Text = "My title"; |
| item.Cells.Add(tc); |
| } |
| } |
| catch (Exception exc) |
| { |
| } |
| } |
Any ideas or suggestions to skip this problem?