ITHelper80
asked on
Move values from Datatable to Gridview columns based on values
I have a datatable with the following
ORID DATE TYPE HOURS WKDATE PUDATE PUINOUT PUTIME PUINOUT1 PUTIME1
79159 05/16/2009 OT 8.00 20090516 20090516 I 443 O 1322
79159 05/18/2009 WH 8.00 20090518 20090518 I 638 O 1522
79159 05/19/2009 WH 8.00 20090519 20090519 I 643 O 1528
79159 05/20/2009 OT 2.20 20090520 20090520 I 446 O 1530
79159 05/20/2009 WH 8.00 20090520 20090520 I 446 O 1530
My Gridview has Date, In,Out, Overtime, etc
How can I place the Hours value into my Overtime Column when Type = OT?
ORID DATE TYPE HOURS WKDATE PUDATE PUINOUT PUTIME PUINOUT1 PUTIME1
79159 05/16/2009 OT 8.00 20090516 20090516 I 443 O 1322
79159 05/18/2009 WH 8.00 20090518 20090518 I 638 O 1522
79159 05/19/2009 WH 8.00 20090519 20090519 I 643 O 1528
79159 05/20/2009 OT 2.20 20090520 20090520 I 446 O 1530
79159 05/20/2009 WH 8.00 20090520 20090520 I 446 O 1530
My Gridview has Date, In,Out, Overtime, etc
How can I place the Hours value into my Overtime Column when Type = OT?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
THank ged...Im going to try your solution first since you posted first.
Ive got one question, how can I bind the value of the reader to my columns?
Ive tried this but get an error about a readonly property.
AS400DT.Columns("Overtime" ) = readerobjrs7.Item("Hours") .ToString
Ive got one question, how can I bind the value of the reader to my columns?
Ive tried this but get an error about a readonly property.
AS400DT.Columns("Overtime"
ASKER
I was able to figure out how to bind the rows with a reader. Thanks for the suggestions.
if e.row.rowtype = datarow{
if e.row["Type"] == "OT"{
e.row["type"] = e.row["hours"]
}
}