473,785 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Typed DataSet, GridView and Computed Column

Hi,
I have created a Typed DataSet. The DataTable is (distrimarket.D atiDT).
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.Da taRow' to type 'DataTable1Row' .
Could you tell me what is wrong please ?
protected void GridView2_RowDa taBound(object sender, GridViewRowEven tArgs e)
{
System.Data.Dat aRowView drv;
drv = (System.Data.Da taRowView)e.Row .DataItem;
try{

if (e.Row.RowType == DataControlRowT ype.DataRow)
{
distrimarket.Da tiDTRow dati = (distrimarket.D atiDTRow)drv.Ro w;

if (!dati.IsQta_In viatoNull() && !dati.IsQTa_Res oNull())
{
sold += dati.Qta_Inviat o - dati.QTa_Reso;
e.Row.Cells[4].Text = sold.ToString() ;
}

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

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

Similar topics

1
2267
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 column x There are some rows in table A and table B. When I want to add a row from table A to table B I use the function TableA.ImportRow(TableB.rows); // for example
1
3938
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 displayed correctly. I encounter now a problem with editing the data. Not all columns are displayed, only some (AutoGenerateColumns == false), therefore I can't use the default "Update" methode of the generated DataSet because it required all columns...
1
1931
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
1637
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 know the itemtemplate workarounds or through row events. It's that i'm trying to use the internal format stuff itself. Is this possible?
3
14442
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 that I can't seem to resize my dataview's columns which are auto generated. Is there a way to do this? I have tried several different things, but I can't seem to get at the column collection to change the widths? MY development environment
4
2522
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 gridview1.datasource = t.getdata() gridview1.databind() Now I create new query in the TableAdapters dataset
13
4665
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
7404
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 grid just fine, but I can't get the automated column (column index 1) to be set to readonly. (Column 0 is actually an automated column of edit buttons) here's my code: DataSet ds = new DataSet(); DataTable dt = new DataTable();...
12
3604
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 gridview, for example, I loop through a datareader, populating an array list with instances of a custom class in the middle tier, and then send the array list up to the presentation layer and bind the gridview to it. If I use a typed dataset, I...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10087
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.