Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem getting EditCommand event to fire in nested DataGrid

Problem getting EditCommand event to fire in nested DataGrid

Scheduled Pinned Locked Moved ASP.NET
helpquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phillip Donegan
    wrote on last edited by
    #1

    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

    P 1 Reply Last reply
    0
    • P Phillip Donegan

      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

      P Offline
      P Offline
      Phillip Donegan
      wrote on last edited by
      #2

      Still trying to solve this, anyone got any ideas at all?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups