471,084 Members | 849 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 1152

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

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.