473,326 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Grid View


I want to cpunt the number of rows in GridView. But it gives me the
following error
System.InvalidCastException: Unable to cast object of type 'UsersDataTable'
to type 'System.Data.DataView'.

The following is my event handler.

protected void ObjectDataSource1_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{

Label2.Text = "Total Record count in the dropdownlist above= " +
((DataView)e.ReturnValue).Count.ToString();
}
Sep 4 '07 #1
3 2497
generally a good idea to pull apart nested operations when you have
issues like this.

try inspecting what e.ReturnValue actually is. I suspect that its a
UsersDataTable. :)

Sep 4 '07 #2
When I do UsersDataTable it gives me following error

The type or namespace name 'UsersDataTable' could not be found (are you
missing a using directive or an assembly reference?)
Label2.Text = "Total Record count in the gridview above= " +
((UsersDataTable)e.ReturnValue).Count.ToString();


"to*********@gmail.com" wrote:
generally a good idea to pull apart nested operations when you have
issues like this.

try inspecting what e.ReturnValue actually is. I suspect that its a
UsersDataTable. :)

Sep 4 '07 #3
Put a breakpoint somewhere in ObjectDataSource1_Selected and see
e.ReturnValue in debugger's Watch windows, there you can see
completely qualified typename to which it can be casted.

Sep 5 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
2
by: Jan Mueller | last post by:
Hi all, I don't know whether this is the right group, let me know :-). I tried to open this XML file (with internal DTD) with XMLSpy 2005. I guess some of you also use this tool. ...
2
by: Rhonda | last post by:
Using AccessXP I have lost snap to grid on my system. New or existing databases do not snap to grid for forms and reports in design view. Anyone have an idea on how to get it back?? Thanks. ...
4
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
0
by: ¿ Mahesh Kumar | last post by:
I have created a XML file as datasource which i 'm binding to a grid view control. During runtime I'm capturing items in XML file and displaying in a GRID VIEW control. but i want to remove or...
1
by: Ed | last post by:
hi everyone, maybe someone can give me a hand here. I am working with vb 2005 and i have a gridview that i am loading data from a recordset. I have the recordset returned from the query and i am...
2
by: probashi | last post by:
Hi, Using the SqlDataSource/SelectParameters/ControlParameter one can easily bind a Grid View with a list box (or any other controls), pretty cool, but my list box is multi select. My...
2
by: Umeshnath | last post by:
Hi, I have placed a grid view inside Atlas panel. On click of a button event, data is populated in the grid view, I want to add scroll bar instead of increasing the size of grid view. I have...
0
by: zafar | last post by:
I don't know what property should be used for hiding colums in Data Grid, whereas in Data Grid View we have DataGridView1.Colums(index).Visible = False , But how can I hide Colums in Data Grid.....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.