A better solution is to assign unique IDs (and ClientInstanceNames), as well as scripts, to controls at runtime.
This approach is described in the following Knowledge Base article: The general technique of using the Init/Load event handler.
and then another approach is that handle the ASPxGridView.DataBound event of the detail grid and get a reference to the grid via the sender parameter. Here you can call the ASPxGridView.FindDetailRowTemplateControl method of the master grid if you are using Master Details.
If you are using GridView's DataRowTemplate then use the
ASPxGridView.FindRowTemplateControl Method, you just need to get
the visibleIndex of the row and you are able to access the grid with
it's name.
If you are using Coloumn template then use ASPxGridView.FindRowCellTemplateControl Method
protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) {
if(e.DataColumn.FieldName == "title") {
ASPxTextBox textBox = ASPxGridView1.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "ASPxTextBox1") as ASPxTextBox;
textBox.Text = Convert.ToString(e.CellValue);
}
}
Reference these:
ASPxGridView - How to access controls inside DetailRow on the client side