473,395 Members | 1,568 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,395 software developers and data experts.

Typed DataSet, GridView and Computed Column

Hi,
I have created a Typed DataSet. The DataTable is (distrimarket.DatiDT).
Then a GridView is populated. The last column is computed and it is the
difference between the previous two. I get this error: Unable to cast object
of type 'System.Data.DataRow' to type 'DataTable1Row'.
Could you tell me what is wrong please ?
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
System.Data.DataRowView drv;
drv = (System.Data.DataRowView)e.Row.DataItem;
try{

if (e.Row.RowType == DataControlRowType.DataRow)
{
distrimarket.DatiDTRow dati = (distrimarket.DatiDTRow)drv.Row;

if (!dati.IsQta_InviatoNull() && !dati.IsQTa_ResoNull())
{
sold += dati.Qta_Inviato - dati.QTa_Reso;
e.Row.Cells[4].Text = sold.ToString();
}

}
}
catch (Exception ex)
{
string err;
err = "Description: " + ex.Message;
}
}
Jun 30 '06 #1
0 2891

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

Similar topics

1
by: Ersin Gençtürk | last post by:
I have 2 typed data tables inherited from the same dataset schema One called : table A with an identity column x column x is constrained to be unique. Other one is : table B with an identity...
1
by: Markus Palme | last post by:
Hi NG! I've created a typed dataset by dropping a table from the server explorer to the dataset designer. I bound this DataSet to a GriedView using a ObjectDataSource. The data is being...
1
by: Dave | last post by:
I am relativly new to visual basic, so this may be a no- brainer. I am attempting to use a computed column in a VB dataset defined as followe: ' 'dcCost ' Me.dcCost.ColumnName = "Cost"
5
by: Edwin Knoppert | last post by:
I want to format a hyperlink bounded field. Fields *could* have http:// *or not* in the websitename entered. I want to format this to http://website.com otherwise i'll get a relative link. I...
3
by: BartMan | last post by:
Greetings, I have a gridview which is sitting on a multi view control (witin a view), and it is bound to a dataset which I dynamically apply to the control within asp.net page. The problem is...
4
by: Ted Ngo | last post by:
I create a northwind Strongly Typed TableAdapters dataset, the create a query like "select a, b, c, d from employeetable" then bind it into the gridview dim t as new northwindTableAdapters...
13
by: Rotsey | last post by:
Hi, I have created a typed dataset (xsd file) with 2 tables and a relation between them in VS2005. How I do I now bind that dataset to a Gridview?? When i do this the page is blank.
3
by: ASPnewb1 | last post by:
I am currently filling a dataTable then adding this table to a dataset, setting the dataset to the Gridview's datasource. If I set the Gridview to generate columns automatically it will fill the...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.