I have a Radgrid which binds to a dataset to display four columns per row of a database table. This table is in fact much larger and contains many foreign key references.
If I select a row to edit I would like to extract the datakey(PK) and fetch the full business object with all related objects (foreign key objects) and assign it to the DataItem object of the GridEditFormItem object. I have databinding expressions in my page which I would like to keep which are set to bind to a business object graph in the Edit form.
My reason for not initially binding to the full object is the size and number of database calls required to fetch each object and related objects to simply display four properties in the grid in order to decide which object to edit.
How would I achieve the above scenario without manually doing a findcontrol for each control in my edit form template and assigning each property to each control as I already have the databinding syntax in the edit form ?
Example of implementation:
{}
If I select a row to edit I would like to extract the datakey(PK) and fetch the full business object with all related objects (foreign key objects) and assign it to the DataItem object of the GridEditFormItem object. I have databinding expressions in my page which I would like to keep which are set to bind to a business object graph in the Edit form.
My reason for not initially binding to the full object is the size and number of database calls required to fetch each object and related objects to simply display four properties in the grid in order to decide which object to edit.
How would I achieve the above scenario without manually doing a findcontrol for each control in my edit form template and assigning each property to each control as I already have the databinding syntax in the edit form ?
Example of implementation:
protected void Grid_OnRowEditing(object sender, ???args e)????? { |
string primaryKey = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["PrimaryKey"].ToString(); |
BusinessObject ob = MyDataManager.GetBusObjectByPrimaryKey(primaryKey); |
e.Item.DataItem = (object)ob; |
//// The EDIT form would then bind to the above object and NOT the Dataset used to display the grid data. |
} |