Hi
this is the first time i've tried to use the admin templates and i've run into a problem. got two tables [User] and [Address] User table has a pk UserId and Address table has an fk of UserId as well. i'm generating a admin control for the User table and i select the Address table on the Details Grids tab under the list of foreign keys. I've created a view of the Address table as only views are shown in the drop down (p.s. this drop down is not mentioned in the help doc - but i'm assuming its defining the columns to show in the detail grid) following the screen-shot in the help doc and selected the UserId column from the second dropdown. in the list of fields below that i've select a couple of columns to display in the detail grid. i've also tried without selecting a view. now when i generate my admin control there is a method generated:
Code:
private void gdFK_Address_UserLoad()
{
UserCollection obj = new UserCollection();
obj.Query.Select
(
obj.Query.Id,
obj.Query.Name,
obj.Query.Line1,
obj.Query.Line2,
obj.Query.City,
obj.Query.County,
obj.Query.Country,
obj.Query.Postcode
)
.Where(obj.Query.UserId.Equal(this.Id));
string sortExpression = this.GetSortExpression("FK_Address_User");
if (sortExpression != "")
obj.Query.OrderBy(sortExpression, GetSortDirectionEnum("FK_Address_User"));
if (!obj.Query.Load())
{
// Force it to show headers but disable "Select"
obj.AddNew();
this.gdFK_Address_User.Columns[0].Visible = false;
}
this.gdFK_Address_User.DataSource = obj;
this.gdFK_Address_User.DataBind();
}
You can see that it is instantiating an instance of the UserCollection class however the Query is using the columns from the Address table. I thought that maybe my relationship was wrong however my es classes are generated and working correctly.
any idea what i'm doing wrong?
Thanks
p.s. keep up the good work guys! you're doing a fantastic job!
Sean Rock