Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1110377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:23:10+00:00 2026-05-17T02:23:10+00:00

Has anyone come across an error like the following: Unable to cast object of

  • 0

Has anyone come across an error like the following:

Unable to cast object of type 'CompaniesDataTable' to type 'CompaniesDataTable'.

Here is the code that is causing the error:

    protected void ObjectDataSource_Companies_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        int x = ((Adala.CompaniesDataTable)(e.ReturnValue)).Count;
    }

What I’m trying to do is to get the total number of rows of gridview returned by the objectdatasource but it gives me that error.

Why is it not able to cast type to the same type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:23:11+00:00Added an answer on May 17, 2026 at 2:23 am

    OK Thanks Shaji for not answering,
    Any way I found a solution for my problem.

    I created a BLL Class and instantiated it instead of Direct Instantiating Dataset Classes.

    inside BLL i created this method

    public Adala.CompaniesDataTable GetCompanies(out int rowsCount)
    {
        Adala.CompaniesDataTable dt = Adapter.GetCompanies();
        rowsCount = dt.Count;
        return dt;
    }
    

    then i can use the property e.OutputParameters[“rowsCount”].ToString();
    in the Method Objectdatasource.Selected event

    protected void ObjectDataSource_Companies_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        string rowsCount = e.OutputParameters["rowsCount"].ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering has anyone come across thos error in SIP before? WARN/System.err(4623): javax.sip.SipException:
Has anyone come across a software that can dynamically stream an arbitrary source identified
I'm wondering if anyone has ever come across a plug-in for mootools that will
I wonder if anyone has come across this error and can explain what's happening:
Has anyone come across this error (see below). It happens when i drag a
Has anyone come across this issue before?
Has anyone else come across this at all? I used to be able to
I am wondering if anyone has come across a way to generate tones in
I was just wondering if anyone has come across anything offering similar search functionality
Has anyone come across this before and know a solution? I'm using Shadowbox to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.