【发布时间】:2012-01-05 19:55:15
【问题描述】:
我正面临selectcountmethod 未被调用的情况。
getdatamethod 每次都会被调用,但 count 方法不会。我还尝试删除selectcountmethod并设置enablepaging="false",即使数据集不为空,也没有显示任何数据。
<asp:GridView ID="gvGradeDocent" runat="server" AutoGenerateColumns="False" AllowPaging="True"
DataSourceID="odsGradeDocent" DataKeyNames="Id" PagerStyle-HorizontalAlign="Right"
PagerSettings-Position="Top" CssClass="table">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" Visible="false" />
<asp:BoundField DataField="DecisionNo" HeaderText="DecisionNo" SortExpression="DecisionNo" />
<asp:BoundField DataField="DecisionDate" HeaderText="DecisionDate" SortExpression="DecisionDate"
DataFormatString="{0:dd/MM/yyyy}" />
<asp:CheckBoxField DataField="Status" HeaderText="Status" SortExpression="Status" />
<asp:CommandField ShowSelectButton="True" ButtonType="Image" SelectImageUrl="~/Images/edit.png" />
<asp:CommandField ShowDeleteButton="True" ButtonType="Image" DeleteImageUrl="~/Images/delete.png" />
</Columns>
</asp:GridView>
</div>
<asp:ObjectDataSource ID="odsGradeDocent" runat="server" SelectMethod="GetDocentGrades"
TypeName="mash.BusinessLogic.DocentGrade" EnablePaging="True" DeleteMethod="Delete"
SelectCountMethod="GetCountDocentGrades"></asp:ObjectDataSource>
【问题讨论】:
-
首先在 SQL Server 中检查您的查询?