在ObjectDataSource控件selectcountmethod不叫 [英] selectcountmethod in objectdatasource isn't called

查看:146
本文介绍了在ObjectDataSource控件selectcountmethod不叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在面临这样一种情况: selectcountmethod 不叫。

getdatamethod 被称为每次,但计数法是没有的。我也试着删除 selectcountmethod 并设置 enablepaging =FALSE键,要么显示任何数据,即使数据集是不是空的。

 < ASP:GridView控件ID =gvGradeDocent=服务器的AutoGenerateColumns =FALSEAllowPaging =真
        的DataSourceID =odsGradeDocent的DataKeyNames =IDPagerStyle-Horizo​​ntalAlign =右
        PagerSettings-位置=顶部的CssClass =表>
        <柱体和GT;
            < ASP:BoundField的数据字段=ID的HeaderText =IDSORTEX pression =ID可见=假/>
            < ASP:BoundField的数据字段=DecisionNo的HeaderText =DecisionNoSORTEX pression =DecisionNo/>
            < ASP:BoundField的数据字段=DecisionDate的HeaderText =DecisionDateSORTEX pression =DecisionDate
                DataFormatString ={0:DD / MM / YYYY}/>
            < ASP:CheckBoxField字段的DataField =状态的HeaderText =状态SORTEX pression =状态/>
            < ASP:CommandField中ShowSelectButton =真按钮类型=图像SelectImageUrl =〜/图片/ edit.png/>
            < ASP:CommandField中的ShowDeleteButton =真按钮类型=图像DeleteImageUrl =〜/图片/ delete.png/>
        < /专栏>
    < / ASP:GridView的>
< / DIV>
< ASP:ObjectDataSource控件ID =odsGradeDocent=服务器SelectMethod =GetDocentGrades
    类型名=mash.BusinessLogic.DocentGradeEnablePaging =真DeleteMethod =删除
    SelectCountMethod =GetCountDocentGrades>< / ASP:ObjectDataSource控件>


解决方案

尝试使用code样品在这里工作:

<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.enablepaging.aspx\" rel=\"nofollow\">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.enablepaging.aspx

首先检查您的查询,以确保数据回来。同时设定在选择查询的MaximumRowsParameterName和StartRowIndexParameterName参数到相应的PARAMS。

I am facing a situation where the selectcountmethod isn't called.

The getdatamethod is called every time, but the count method is not. I also tried to remove the selectcountmethod and set enablepaging="false" and no data is displayed either, even if the dataset is not empty.

<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>

解决方案

Try working with the code sample here:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.enablepaging.aspx

Check your query first to ensure that data is coming back. Also set the MaximumRowsParameterName and StartRowIndexParameterName parameters to the corresponding params in your select query.

这篇关于在ObjectDataSource控件selectcountmethod不叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆