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. Datagrid Editcommand for only record on second pag

Datagrid Editcommand for only record on second pag

Scheduled Pinned Locked Moved ASP.NET
designannouncementlearning
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.
  • B Offline
    B Offline
    bubberz
    wrote on last edited by
    #1

    Step 1: In my datagrid, if I click on the only row on the second page, it takes me to the first record on the first page. Step 2: If I add a second row to the second page, then click "Edit" on the top / first record on the second page, I can now edit that record that I couldn't edit in Step 1. Here's the Editcommand code: DataGrid1.EditItemIndex = e.Item.ItemIndex SqlDataAdapter1.Fill(Dssqla1, "Resource Table") SqlDataAdapter2.Fill(Dssqlb1, "Resource Table - Combo Codes") SqlDataAdapter3.Fill(Dssqlc1, "Signature_Authority_Names") DataGrid1.DataBind() ***** I went back to the old code, and it's working correctly. Here's what I did: 1. The original datagrid on the EditCommand event simply populated dropdownlists in several of the fields / columns in the datagrid. This worked fine, but the width allotment wasn't enough. These ddls were small and difficult for users to read. 2. The new datagrid had the EditItem template changed and all three dropdownlists were placed in the same column to allow for the dropdownlists to have enough width and ample font size. It made the datagrid better from a UI perspective. I can't see anything different in the datagrid EditCommand in either version of the code. The ItemDataBound routine is the same too. Thanks!

    B 1 Reply Last reply
    0
    • B bubberz

      Step 1: In my datagrid, if I click on the only row on the second page, it takes me to the first record on the first page. Step 2: If I add a second row to the second page, then click "Edit" on the top / first record on the second page, I can now edit that record that I couldn't edit in Step 1. Here's the Editcommand code: DataGrid1.EditItemIndex = e.Item.ItemIndex SqlDataAdapter1.Fill(Dssqla1, "Resource Table") SqlDataAdapter2.Fill(Dssqlb1, "Resource Table - Combo Codes") SqlDataAdapter3.Fill(Dssqlc1, "Signature_Authority_Names") DataGrid1.DataBind() ***** I went back to the old code, and it's working correctly. Here's what I did: 1. The original datagrid on the EditCommand event simply populated dropdownlists in several of the fields / columns in the datagrid. This worked fine, but the width allotment wasn't enough. These ddls were small and difficult for users to read. 2. The new datagrid had the EditItem template changed and all three dropdownlists were placed in the same column to allow for the dropdownlists to have enough width and ample font size. It made the datagrid better from a UI perspective. I can't see anything different in the datagrid EditCommand in either version of the code. The ItemDataBound routine is the same too. Thanks!

      B Offline
      B Offline
      bubberz
      wrote on last edited by
      #2

      Tried something else....still frustrated...but getting a little closer! I can look at the record in question (only record on second page) and paste the following data in a label of: lblItemIndex.Text = e.Item.ItemIndex.ToString() lblItemIndex &= " " & DataGrid1.CurrentPageIndex lblItemIndex.Text &= " " & e.Item.Cells(15).Text.toString() ...this label shows that I'm in fact clicking on that only record on the second page, but still the Datagrid goes to the first record on the first page. If I add another record, so now the second page has two records, I can then edit this particular record on the second page.

      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