【发布时间】:2015-08-19 03:04:42
【问题描述】:
我在网页中使用 RadGrid 并使用 ObjectDataSource 绑定它,如下所示:
<asp:ObjectDataSource ID="odsMonthlyStatusReport" runat="server" SelectMethod="GetMonthlyReport_Test" TypeName="atQuest.Projects.Sunway.IPRRequest">
<SelectParameters>
<asp:ControlParameter ControlID="ddlMonth" Name="month" PropertyName="SelectedValue"
Type="String" ConvertEmptyStringToNull="true" />
<asp:ControlParameter ControlID="ddlYear" Name="year" PropertyName="SelectedValue"
Type="String" ConvertEmptyStringToNull="true" />
</SelectParameters>
</asp:ObjectDataSource>
<telerik:RadGrid ID="GridReport" runat="server" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" ShowGroupPanel="True"
CellSpacing="0" GridLines="None" Width="100%" Skin="Outlook" DataSourceID="odsMonthlyStatusReport" OnItemDataBound="GridReport_ItemDataBound">
<ClientSettings AllowDragToGroup="True" />
<GroupingSettings CaseSensitive="false"></GroupingSettings>
<MasterTableView AllowFilteringByColumn="true" AllowMultiColumnSorting="false" AutoGenerateColumns="false"
CommandItemDisplay="Top" DataKeyNames="RequestID" EnableGroupsExpandAll="true"
GroupLoadMode="Client" PageSize="50">
<CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="true" />
<SortExpressions>
<telerik:GridSortExpression FieldName="RequisitionNo" SortOrder="Descending" />
</SortExpressions>
<PagerStyle AlwaysVisible="True" PageSizeControlType="RadComboBox" Position="Bottom" PageSizes="50,100,150,200" />
<Columns>
//all GridBound columnc
</Columns>
</MasterTableView>
<ExportSettings SuppressColumnDataFormatStrings="True" IgnorePaging="True" ExportOnlyData="True" Excel-Format="ExcelML" OpenInNewWindow="True" FileName="eAPDocHistory" Excel-FileExtension="xls">
</ExportSettings>
</telerik:RadGrid>
下面是Class文件(IPRRequest.cs)代码:
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static DataTable GetMonthlyReport_Test(string Month, string Year, string orderBy)
{
Data data = new Data();
Dictionary<string, object> input = new Dictionary<string, object>()
{
{"@Month", Month},
{"@Year", Year},
};
return data.ExecuteQuery(CommandType.StoredProcedure, "[Invoice].[usp_tbl_Request_Select_MonthlyStatusReport]", input);
}
然后,我使用“调试”和“发布”选项构建,并部署 .dll 的“发布”文件夹到服务器。它总是抛出以下错误:
我可以看到所有代码在我的情况下都是正确的。那为什么我会收到这个错误?请让我知道我的代码有什么问题或者有什么遗漏。请回复。
【问题讨论】:
标签: c# asp.net radgrid objectdatasource