Note that there are some explanatory texts on larger screens.

plurals
  1. POObjectDataSource does not call SelectCount Method
    primarykey
    data
    text
    <p>can you please help me to find the problem:</p> <p>I want to implement simple DataGrid and ObjectDataSource bundle with paging</p> <p><strong>my .aspx file</strong></p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:DataGrid ID="DataGrid1" runat="server" DataSourceID="ObjectDataSource1" AllowPaging="true" PageSize="2" &gt; &lt;/asp:DataGrid&gt; &lt;asp:ObjectDataSource runat="server" ID="ObjectDataSource1" TypeName="WebApplication1.AssetComments" SelectMethod="SelectMethod2" StartRowIndexParameterName="startRowIndex" MaximumRowsParameterName="maximumRows" SortParameterName="sortParameter" SelectCountMethod="GetCount" EnablePaging="True" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>My AssetComments class</strong></p> <pre><code>namespace WebApplication1 { public class AssetComments { public List&lt;RSSFeed&gt; SelectMethod2(int startRowIndex, int maximumRows, string sortParameter) { return SelectMethod2().Skip(startRowIndex).Take(maximumRows).ToList(); } public List&lt;RSSFeed&gt; SelectMethod2() { List&lt;RSSFeed&gt; ret = new List&lt;RSSFeed&gt;(2) { new RSSFeed("11", "1111111"), new RSSFeed("22", "2222222") }; return ret; } public int GetCount() { return 55; } } public class RSSFeed { public string Title { get; set; } public string Description { get; set; } public RSSFeed(string title, string description) { Title = title; Description = description; } } } </code></pre> <p>for some reason asp.net cals SelectMethod2 with (0,0,"") parameters and does not call GetCount.</p> <p>please help me find the problem</p> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload