Link to home
Start Free TrialLog in
Avatar of Justice75
Justice75

asked on

Get the value of SelectCountMethod

Hi All,

Does anyone know how to get the value of the SelectCountMethod in an ObjectDataSource and add it to the header of a GridView and a textbox?  I am using a BLL, DAL, C#.   There is some  sample code.  Any help would be greatly appreciated.

Jus


The code from the DAL is:

SELECT COUNT(*)
FROM phone_Makes
=========================================================
The code from the BLL is:

    public int TotalNumberOfMakes()
    {
        return Adapter.TotalNumberOfMakes().GetValueOrDefault();
    }
==========================================================
The code from the ObjectDataSoure:

        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            SelectMethod="GetMakesPagesAndSorted" 
            TypeName="MakesBLL" 
            EnablePaging="True" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCountMethod="TotalNumberOfMakes" 
            SortParameterName="sortExpression">
            <SelectParameters>
            </SelectParameters>            
        </asp:ObjectDataSource>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of RameshS
RameshS
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Justice75
Justice75

ASKER

Ramesh,

Thank you for your response.  Should that be in the GridView1_Load method or some other one?  Thank you.. This worked perfect.

Jus
Clear, concise and straight to the point!
Also, When I added it to the Columns[2] it replaced the header text for that column.  Is there any way that it can go on the row with the paging mechanism?

Jus