Problem getting EditCommand event to fire in nested DataGrid
-
Hi All, I have a details view which contains a datagrid. They are both populating fine but now I want to edit the rows in the datagrid. I'm setting up the datagrid like so:
protected override void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}private void InitializeComponent() { DataGrid productCulturesDataGrid = ((DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid")); productCulturesDataGrid.EditCommand += new DataGridCommandEventHandler(this.ProductsCultureDataGrid\_EditCommand); this.Load += new System.EventHandler(this.Page\_Load); }
And then in the page load method i'm setting the datasource like so:
//GetListOfProductCultures
List<ProductsCultureInfo> productCultures = (List<ProductsCultureInfo>)ListOfProductCultures();DataGrid productCulturesDataGrid = ((DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid"));
productCulturesDataGrid.DataSource = productCultures;
productCulturesDataGrid.DataBind();The EditCommand method looks like this but is never triggered:
private void ProductsCultureDataGrid\_EditCommand(object sender, DataGridCommandEventArgs e) { DataGrid ProductsCultureDataGrod = (DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid"); ProductsCultureDataGrod.EditItemIndex = e.Item.ItemIndex; }
Any ideas what i'm doing wrong? Also not sure if this has anything to do with it but this is a dotnetnuke module. Thanks Phil P.S. here is the ascx page encase that helps
-
Hi All, I have a details view which contains a datagrid. They are both populating fine but now I want to edit the rows in the datagrid. I'm setting up the datagrid like so:
protected override void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}private void InitializeComponent() { DataGrid productCulturesDataGrid = ((DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid")); productCulturesDataGrid.EditCommand += new DataGridCommandEventHandler(this.ProductsCultureDataGrid\_EditCommand); this.Load += new System.EventHandler(this.Page\_Load); }
And then in the page load method i'm setting the datasource like so:
//GetListOfProductCultures
List<ProductsCultureInfo> productCultures = (List<ProductsCultureInfo>)ListOfProductCultures();DataGrid productCulturesDataGrid = ((DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid"));
productCulturesDataGrid.DataSource = productCultures;
productCulturesDataGrid.DataBind();The EditCommand method looks like this but is never triggered:
private void ProductsCultureDataGrid\_EditCommand(object sender, DataGridCommandEventArgs e) { DataGrid ProductsCultureDataGrod = (DataGrid)ProductDetailsView.FindControl("ProductsCultureDataGrid"); ProductsCultureDataGrod.EditItemIndex = e.Item.ItemIndex; }
Any ideas what i'm doing wrong? Also not sure if this has anything to do with it but this is a dotnetnuke module. Thanks Phil P.S. here is the ascx page encase that helps
Still trying to solve this, anyone got any ideas at all?