Hi, I fill RadGrid in NeedDataSource like this:
Here is one of the columns that causes the mentioned exception:
The funny thing is that db data is returned properly from LoadForPerformance method! And there is no error in SQL part! The exception happens AFTER! The grids with using "static" ObjectDataSource work without any problem in such cases, i.e. I can indicate field names or full names, using DB schema, table name and column name like SortExpression="SF.SAN_SWITCH.NAME"...
protected
void
rgPortConfigView_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
var grid = (RadGrid) sender;
IList<Swfc_Port_ConfigInfo> lpi;
var spc =
new
Swfc_Port_Config_StateController();
var dateRange = B4DateTimePicker.DateFromDateToFromPickerOrDefault(Page,
"B4DateTimePickerDatesFilter"
, DateTime.Now.AddDays(-6), DateTime.Now, UrlConst.DATE_FROM, UrlConst.DATE_TO);
this
.dateFrom = dateRange.DateFrom;
this
.dateTo = dateRange.DateTo;
int
sfSanSwitchId;
if
(
int
.TryParse(Request.QueryString[UrlConst.SF__SAN_SWITCH__ID],
out
sfSanSwitchId))
{
QueryParams.SetValue(
"SAN_SWITCH_ID"
, sfSanSwitchId, FilterCondition.Equal,
false
);
}
int
sfSwfcPortConfigSwfcPortIndex;
if
(
int
.TryParse(Request.QueryString[UrlConst.SF__SWFC_PORT_CONFIG__SWFC_PORT_INDEX],
out
sfSwfcPortConfigSwfcPortIndex))
{
QueryParams.SetValue(
"SWFC_PORT_INDEX"
, sfSwfcPortConfigSwfcPortIndex, FilterCondition.Equal,
false
);
}
switch
(SubTabID)
{
case
"top20ports"
:
lpi = spc.LoadForPerformance(0, 20,
"PERFORMANCE_IOSUM DESC"
,
this
.dateFrom,
this
.dateTo);
this
.rgPortConfigView.DataSource = lpi;
break
;
case
"allports"
:
lpi = spc.LoadForPerformance(0, Int32.MaxValue - 2, grid.MasterTableView.SortExpressions.GetSortString() ??
"PERFORMANCE_IOSUM DESC"
,
this
.dateFrom,
this
.dateTo);
this
.rgPortConfigView.DataSource = lpi;
break
;
case
"top10isl"
:
lpi = spc.LoadForPerformanceISL(0, 10,
"PERFORMANCE_IOSUM DESC"
,
this
.dateFrom,
this
.dateTo);
this
.rgPortConfigView.DataSource = lpi;
break
;
case
"top20isl"
:
lpi = spc.LoadForPerformanceISL(0, 20,
"PERFORMANCE_IOSUM DESC"
,
this
.dateFrom,
this
.dateTo);
this
.rgPortConfigView.DataSource = lpi;
break
;
case
"allisl"
:
lpi = spc.LoadForPerformanceISL(0, Int32.MaxValue - 2, grid.MasterTableView.SortExpressions.GetSortString() ??
"PERFORMANCE_IOSUM DESC"
,
this
.dateFrom,
this
.dateTo);
this
.rgPortConfigView.DataSource = lpi;
break
;
case
"top10ports"
:
default
:
lpi = spc.LoadForPerformance(0, 10,
"PERFORMANCE_IOSUM DESC"
,
this
.dateFrom,
this
.dateTo);
this
.rgPortConfigView.DataSource = lpi;
break
;
}
QueryParams.Remove(
"SAN_SWITCH_ID"
);
QueryParams.Remove(
"SWFC_PORT_INDEX"
);
}
Here is one of the columns that causes the mentioned exception:
<
telerik:GridTemplateColumn
HeaderStyle-CssClass
=
'GridHeaderGreen la'
ItemStyle-CssClass
=
'la'
UniqueName
=
"San_Switch__DisplayName"
HeaderText
=
"Switch Name"
SortExpression
=
"SAN_SWITCH_NAME"
>
<
ItemTemplate
>
<
asp:HyperLink
ID
=
"hlSwitchName"
runat
=
"server"
Text='<%# Eval("San_Switch.DisplayName") %>' NavigateUrl='<%# GetUrlToSwitchInfo(Container.DataItem) %>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
The funny thing is that db data is returned properly from LoadForPerformance method! And there is no error in SQL part! The exception happens AFTER! The grids with using "static" ObjectDataSource work without any problem in such cases, i.e. I can indicate field names or full names, using DB schema, table name and column name like SortExpression="SF.SAN_SWITCH.NAME"...