This is a migrated thread and some comments may be shown as answers.

RadGrid - Master Details error

1 Answer 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 15 Jul 2011, 06:47 AM
My master radgrid holds Locations and has a primary key of Location_ID

The details table below holds Activities related to the selected Location.

The datasource for the Activity grid included the act_Location_ID in it's where clause, like this.

WHERE act_Location_ID = @loc_Location_ID

All this works 100%. Clicking a Location updates the list of Activities and everyone is happy. :)

However, this page is a search (filter) page. That is, by setting values on a form you can limit the number of locations. Despite this the Location and Activity work in unison. The Activity table shows you the activities for the selected Location.

That is unless your filtering results in NO location returned. In this case the problem begins.

If there is no Locations returned, the Activity grid defaults to showing EVERY activity in the database, regardless of Location ID.

This is a show stopper. Why in the case of there being no Locations returned, does my Activity table disregard the Location ID WHERE clause in its DataSource and return all Activities?








1 Answer, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 15 Jul 2011, 07:21 AM
I fixed this myself... Sorry to trouble anyone who read this.

The issue was to do with Activities that did not have a LocationID (not one related to the location table anyway). I'm not sure why but in the absence of a LocationID these other activities (which had a Location ID of 0) were getting returned.

Odd, but fixed now with a bit of this in the where clause.

WHERE act_Location_ID = @loc_Location_ID and act_Location_ID != 0

This was a strange one. Anyone know why this would happen? Just curious as it is fixed now.
Tags
General Discussions
Asked by
Brad
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
Share this question
or