<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
EnableLinqExpressions
=
"true"
>
</
telerik:RadGrid
>
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridGroupHeaderItem)
{
GridGroupHeaderItem groupHeaderItem = e.Item
as
GridGroupHeaderItem;
DataRowView drv = (groupHeaderItem.DataItem
as
DataRowView);
DataRow dr = (drv.Row
as
DataRow);
var groupItems = dr.ItemArray;
for
(
int
i = 0; i < groupItems.Length; i++)
{
if
(
string
.IsNullOrEmpty(groupItems[i].ToString()))
{
// object{System.DBNull} to object{string} or you can change it to other, depending on the datatype of the Database field
groupItems[i] = String.Empty;
}
}
// assign back the fixed object to the Group item
dr.ItemArray = groupItems;
}
}
Protected
Sub
RadGrid1_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
GridItemEventArgs)
If
TypeOf
e.Item
Is
GridGroupHeaderItem
Then
Dim
groupHeaderItem
As
GridGroupHeaderItem = TryCast(e.Item, GridGroupHeaderItem)
Dim
drv
As
DataRowView = (TryCast(groupHeaderItem.DataItem, DataRowView))
Dim
dr
As
DataRow = (TryCast(drv.Row, DataRow))
Dim
groupItems = dr.ItemArray
For
i
As
Integer
= 0
To
groupItems.Length - 1
If
String
.IsNullOrEmpty(groupItems(i).ToString())
Then
groupItems(i) =
String
.Empty
End
If
Next
dr.ItemArray = groupItems
End
If
End
Sub