代码如下。我能够获得IQueryable
类型的集合,但我也希望获得总行数。
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" DataSourceID="dsBiz"
AutoGenerateColumns="False" ShowHeader="false"
DataKeyNames="PinCodeId" PageSize="5" OnDataBound="GV_DataBound">
</asp:GridView>
<asp:DomainDataSource ID="dds" runat="server" QueryName="GetPinCodeInfoList" DomainServiceTypeName="postoffice.Controller.Biz">
<QueryParameters>
<asp:ControlParameter ControlID="ddlState" Name="stateId" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="ddlDistrict" Name="district" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="ddlTaluka" Name="taluk" PropertyName="SelectedValue" />
</QueryParameters>
</asp:DomainDataSource>
答案 0 :(得分:1)
为此我在方法&#34;之前在HttpContext中添加了计数值。 GetPinCodeInfoList&#34;返回值,然后在需要的地方使用。
` //Added Count in the context
HttpContext.Current.Items.Add("Count", count);
//update that value wherever required
HttpContext.Current.Items["Count"] = count;
//Access that value anywhere in same context
String countString = HttpContext.Current.Items["Count"].ToString();`