Visual Studio .NET - The data source does not support server-side data paging.

Asked By Johann Montfort on 10-Oct-06 02:14 PM
Dear All,

I have the following error:-

The data source does not support server-side data paging.

I cannot seem to find the cause of the problem.

My code is as follows:-

        <tr>
            <td>
                <asp:GridView ID="grdHeaders" runat="server" AllowPaging="True" DataSourceID="dsGetHeaders" AutoGenerateColumns="False" DataKeyNames="headerID"
                        DataMember="DefaultView" OnSelectedIndexChanged="grdHeaders_SelectedIndexChanged" SkinID="gridSkin" Width="80%">
                    <Columns>
                        <asp:BoundField DataField="header_file" HeaderText="Header Name" />
                        <asp:BoundField DataField="admin_menu_tit" HeaderText="Menu Name" />
                        <asp:BoundField DataField="admin_submenu_tit" HeaderText="Sub Menu Name" />
                        <asp:BoundField DataField="language_tit" HeaderText="Language" />
                         <asp:CommandField ShowSelectButton="True" ButtonType="Image" HeaderText="Edit" SelectImageUrl="~/Images/BackendCommon/b_EditIcon.gif" />
                        <asp:TemplateField HeaderText="Delete">
                            <ItemTemplate>
                                <asp:ImageButton ID="btnDelete" ImageUrl="~/Images/BackendCommon/b_DeleteIcon.gif" runat="server"
                                      OnClientClick="if(!confirm('Do you want to delete?')){return false;}" CommandName="Delete" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <asp:ObjectDataSource ID="dsGetHeaders" runat="server" SelectMethod="GetHeaders" TypeName="HeaderBLL" DeleteMethod="DeleteHeader" OnDeleting="dsGetHeaders_Deleting"
                        OnDeleted="dsGetHeaders_Deleted">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="Hamrun_DB" Name="DataSource" Type="String" />
                    </SelectParameters>
                    <DeleteParameters>
                        <asp:Parameter Name="header_id" Type="Int32" />
                        <asp:Parameter Name="header_file" Type="String" />
                        <asp:Parameter Name="DataSource" Type="String" />
                    </DeleteParameters>
                </asp:ObjectDataSource>
            </td>
        </tr>

Can you please help me out?

Thanks for your help and time

Johann
Sushila Patel replied to Johann Montfort on 10-Oct-06 02:41 PM

Check the pagin example for objectdatasource @ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/GridViewEx05.asp

http://fredrik.nsquared2.com/viewpost.aspx?PostID=229

still no solution

Johann Montfort replied to Sushila Patel on 10-Oct-06 03:12 PM
thanks Patel but still no solution to my problem :(
Sushila Patel replied to Johann Montfort on 10-Oct-06 03:25 PM

Have you missed to give EnablePaging="True" for objectdatasource

as you have given

<asp:ObjectDataSource ID="dsGetHeaders" runat="server" SelectMethod="GetHeaders" TypeName="HeaderBLL" DeleteMethod="DeleteHeader" OnDeleting="dsGetHeaders_Deleting"
                        OnDeleted="dsGetHeaders_Deleted">

did not work
Johann Montfort replied to Sushila Patel on 10-Oct-06 04:29 PM
I tried EnablePaging="True", though i have never used that before and got this error:-

ObjectDataSource 'dsGetHeaders' could not find a non-generic method 'GetHeaders' that has parameters: DataSource, maximumRows, startRowIndex.
Sushila Patel replied to Johann Montfort on 10-Oct-06 05:04 PM

<msdnextract>

In order to have the data paged appropriately in the ASP.NET page there are a couple of settings on the ObjectDataSource we must set in order to have paging work correctly:

  • EnablePaging—set this to True.
  • MaximumRowsParameterName—this property provides the name of the first integer parameter to the method that pages the results. It defaults to maximumRows. If you use a different parameter name in your methods, you'll need to specify that parameter name in this property.
  • StartRowIndexParameterName—similar to MaximumRowsParameterName, in that this property value specifies the second integer parameter name for paging. It defaults to startRowIndex, so you only need to set this property explicitly if you use a different parameter name in your code.
  • SelectCountMethod—the name of the method that returns the total number of records to be paged through. (In my example the method name was TotalNumberOfProducts.)

</msdnextract>

Sample check section "Paging and Sorting Data from an ObjectDataSource" @

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/GridViewEx05.asp

error found
Johann Montfort replied to Sushila Patel on 11-Oct-06 01:27 PM
thanks all

I found my error.  I was getting a datareader instead of a dataset!

Now it works fine

Thanks again

Johann
The same Error. Help-me.
Fábio Silva replied to Johann Montfort on 24-Nov-06 12:58 PM

I have the same error:

The data source does not support server-side data paging.

I cannot seem to find the cause of the problem.

The code is as follows:-

stringSQL = "select * from EQUIPAMENTOS where PLACA = '" & Session("usuario") & "'"

Dim conn As New Data.Odbc.OdbcConnection("DSN=teste_odbc;UID=admin;PWD=;")

Dim cmd As New Data.Odbc.OdbcCommand(stringSQL)

cmd.Connection = conn

conn.Open()

Dim recEquiptos As Data.Odbc.OdbcDataReader = cmd.ExecuteReader()

If Not recEquiptos.Read Then

lblStatus.Text = "Não existem Veículos Cadastrados"

''grdEquiptos.Visible = False

Else

If Session("tipo_usuario") = "0" Then

lblCliente.Text = "Cliente: " & recEquiptos("RAZAO_SOCIAL")

Else

lblCliente.Text = "Cliente: " & recEquiptos("NOME")

End If

grdEquiptos.DataSource = recEquiptos

grdEquiptos.DataBind()

recEquiptos.Close()

End If

 

Thanks

Detlef Meyer replied to Fábio Silva on 14-Dec-06 02:26 PM
You have made the same mistake- the datasource is an "OdbcDataReader" and a Reader don't support paging. Fill first a DataSet or DataTable and bind it then as DataSource
deepak replied to Detlef Meyer on 22-Jul-11 01:32 AM
same error : "The data source does not support server-side data paging"
i'm getting same error please help me out... ASAP

the code i used is

//List Contains Column names

List<string> columns = new List<string>();

columns = sourceSortFields.Split(',').ToList<string>();


//Selecting Required columns only
IEnumerable
<DataColumn> selCol = from DataColumn col in SourceResultSet.Tables[0].Columns where columns.Contains(col.Caption) select col;

//Binding
SourceGridView.DataSource = selCol;

SourceGridView.DataBind();

deepak replied to Detlef Meyer on 22-Jul-11 01:34 AM
same error : "The data source does not support server-side data paging"
i'm getting same error please help me out... ASAP

the code i used is

//List Contains Column names

List<string> columns = new List<string>();

columns = sourceSortFields.Split(',').ToList<string>();


//Selecting Required columns only
IEnumerable
<DataColumn> selCol = from DataColumn col in SourceResultSet.Tables[0].Columns where columns.Contains(col.Caption) select col;

//Binding
SourceGridView.DataSource = selCol;

SourceGridView.DataBind();




jsraj singh replied to Johann Montfort on 21-Dec-11 12:50 PM
use    event   OnSelectedIndexChanging
     ok