468,539 Members | 1,521 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,539 developers. It's quick & easy.

How to access the data in a detailsView-- ASP.NET 2.0

Hi,

I have a webpage which has a detailsView control with no paging. On the page's button click event, I need to access one data field to make a desicion.
I have the this detailsView bind to objectDatasource which comes from a dataset called dsRequest.
Here is my code, but I got a "object not set to instance" error which almost drove me crazy. Please help me out. Thanks a lot.

code:

Dim shipmentID As DateTime
Dim request As dsRequest.REQUESTRow
'Got 'object not set to instance' error on the following line
request = CType(CType(requestDetailsView.DataItem, System.Data.DataRowView).Row, dsRequest.REQUESTRow)
If Not request.IsShipmentIDNull() Then
shipmentID = Now()
myDB.InsertShipment(shipmentID)
Else
shipmentID = request.ShipmentID
End If
Session("shipmentID") = shipmentID
Response.Redirect("~\somepage.aspx")

I know I can query the database to get this field value out, but is there another way besides that?

Kity
May 23 '07 #1
0 1103

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Ebbie | last post: by
5 posts views Thread by David | last post: by
1 post views Thread by Aravind | last post: by
7 posts views Thread by Finger.Octopus | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.