I'm setting the DataSource at Runtime but i do not call DataBind method, because it makes BeforePerformDataSelect of the Detail Grid to perform more than one.
This code set the master grids datasource and bind it:
protected void
gv_Answers_CustomCallback(object
sender,
ASPxGridViewCustomCallbackEventArgs e)
{
ConfPrmMTempCollection _ConfPrmMTempCollection = new ConfPrmMTempCollection();
masterKey = e.Parameters;
if (masterKey != "")
{
man.Add(new SqlOperatorEquality("MAND_CONF_PRM_M_TEMP.PARAMETER_M_TEMP_ID", Convert.ToInt32(masterKey)));
gv_Answers.DataSource = gc.LoadCollectionFromCollType(typeof(ConfPrmMTempCollection),man);
gv_Answers.DataBind();
man.Clear();
}
}
And this code is for setting the datasource of the detail grid:
protected void
gv_ParameterTempD_BeforePerformDataSelect(object
sender, EventArgs e)
{
ASPxGridView detailGrid = sender as ASPxGridView;
masterKey = detailGrid.GetMasterRowKeyValue().ToString();
man.Add(new SqlOperatorEquality("MAND_CONF_PRM_D_TEMP.PARAMETER_M_TEMP_ID", Convert.ToInt32(masterKey)));
detailGrid.DataSource = gc.LoadCollectionFromCollType(typeof(ConfPrmDTempCollection),man);
}