This is a migrated thread and some comments may be shown as answers.

[Solved] Problem using GroupByExpressions

1 Answer 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 07 Jul 2009, 04:59 PM
Hi,

My Datasource (datatable) has columns with spaces in them. Can you please show me how to group by a field when they have spaces in them. The following below does not work for me. Please advise.

Dim expression1 As New GridGroupByExpression

 

Dim field1 As New GridGroupByField

 

 

field1 = New GridGroupByField

 

 

field1.FieldName = "Filing Country"

 

 

field1.FieldAlias = "[My Filing Country]"
expression1.SelectFields.Add(field1)

 

 

.MasterTableView.GroupByExpressions.Add(expression1)

Thanks!

 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Jul 2009, 06:58 AM
Hello Andrew,

RadGrid does not support empty spaces, although the DB is able to store these values when wrapped in square brackets. Instead you can replace the empty space using an underscore '_' character, in the datatable directly or in the select command. 

<asp:AccessDataSource ID="AccessDataSource1" runat="server"  
DataFile="~/App_Data/Nwind.mdb"  
SelectCommand="SELECT [Category ID] AS Category_ID, [CategoryName], [Description] FROM [Categories]">   
</asp:AccessDataSource>  
 
<asp:SqlDataSource ID="SqlDataSource1"    
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"    
SelectCommand="SELECT [Category ID] AS Category_ID, [CategoryName], [Description] FROM [Categories]"    
runat="server">   
</asp:SqlDataSource>  

Thanks
Princy.
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or