Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Net Telerik RadGrid

I have a RadGrid that is populating fine.

But on postback I am getting an error in the Item_Created sub

If Not IsDBNull(DataBinder.Eval(e.Item.DataItem, "TourID")) Then
    If DataBinder.Eval(e.Item.DataItem, "TourID").ToString() <> "0" Then
        TourID = CType(DataBinder.Eval(e.Item.DataItem, "TourID"), String)
    End If
End If

Screenprint
User generated image
Avatar of Dirk Strauss
Dirk Strauss
Flag of South Africa image

just an observation, the code you added says "TourID" but the screenshot you added shows "ReservationID"?

Then, in the SQL query, put an isnull around ReservationID field in the select.
ISNULL(ReservationID, '0') AS 'ReservationID'

Open in new window

Avatar of Larry Brister

ASKER

They both are in the same sub and if I bypass the TourID the ReservationID errors out

Maybe this gives some clarification...

In this particular instance... that Grid has no data at all in it for either tours or Reservations.

It is a Dispositions grid so almost anything canbe in there.
I am looking for whether a tourit exists in this particular employee
if you put a break point on line 1979, what is e.Item.DataItem..... what exactly is null?
also, what does that value have on the initial bind (before the postback).
Hey guys,
I added an isnull on the SQL Side...
So getting a 0 or an actual number for TourID and ReservationID on the datarow..

But am still getting this error!
I am going to add a try catch and see what the heck.
ASKER CERTIFIED SOLUTION
Avatar of Dirk Strauss
Dirk Strauss
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Put me on the right track
As it turns out...
If a column is set to Visible = False in my version of the control...
That ID is not discoverable
It must be "Visible = True...
And Display = False.

Sort of a "Who's on first!"