After creating a linq to entity query and posting the query results to a Master Grid's Data Source, how can I update the detail Grid every time a user selects a different row in the Master grid?
For e.g. in the Form Load event I call the queries.
int PageID = -1; RackEntities re = new RackEntities();
private void PageList_Load( object sender, EventArgs e ) { var pageListQuery = from p in re.pages where p.page_id != -1 select new { PageID = p.page_id };
GridViewPage.DataSource = pageListQuery;
var pageImageListQuery = from pi in re.page_image where pi.page_id == PageID select pi;
GridViewPageImage.DataSource = pageImageListQuery; }
|
Then when the selection has changed in the Master Grid I want to update the Detail grid.
private void GridViewPage_SelectionChanged( object sender, EventArgs e ) { var pageImageListQuery = from pi in re.page_image where pi.page_id == //PageID select pi;
GridViewPageImage.DataSource = pageImageListQuery; }
|