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 Assistance

DataGrid Assistance

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netdatabasehelp
2 Posts 2 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.
  • D Offline
    D Offline
    dhbaer
    wrote on last edited by
    #1

    I am using ASP.NET to create this datagrid, but I am trying to do all of the code in the VB code section and not the html section. I am building a datagrid as follows: 3 Text Columns 1 Link Button Column 1 Push Button Column In Property Builder, I have set the "Command Name" for both the Link Button and Push Button columns to "Select". This is so that when the user clicks on the column, I can use the SelectedIndexChange event and determine what row they are clicking on. The only problem is that in doing so, I cannot determine the column they are clicking on. Is there any code I can use on the VB side in the datagrid SelectedIndexChange sub to determine what column was clicked in? Anything from the header of the column or even just the column index itself. The SelectedIndexChange sub is written such: Private Sub dg_LastSevenDays_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dg_LastSevenDays.SelectedIndexChanged End Sub When I try to see what data I can get from 'sender' or 'e', all they reference is the datagrid itself and not anything within it. Search for solutions online, I found a few that would work if this was a compiled application and not a web application. Has anyone run into this before? David

    N 1 Reply Last reply
    0
    • D dhbaer

      I am using ASP.NET to create this datagrid, but I am trying to do all of the code in the VB code section and not the html section. I am building a datagrid as follows: 3 Text Columns 1 Link Button Column 1 Push Button Column In Property Builder, I have set the "Command Name" for both the Link Button and Push Button columns to "Select". This is so that when the user clicks on the column, I can use the SelectedIndexChange event and determine what row they are clicking on. The only problem is that in doing so, I cannot determine the column they are clicking on. Is there any code I can use on the VB side in the datagrid SelectedIndexChange sub to determine what column was clicked in? Anything from the header of the column or even just the column index itself. The SelectedIndexChange sub is written such: Private Sub dg_LastSevenDays_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dg_LastSevenDays.SelectedIndexChanged End Sub When I try to see what data I can get from 'sender' or 'e', all they reference is the datagrid itself and not anything within it. Search for solutions online, I found a few that would work if this was a compiled application and not a web application. Has anyone run into this before? David

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Look at the Checkboxes and Textboxes section DataGridItem Item = (DataGridItem)(((System.Web.UI.Control)sender).NamingContainer); Though it isn't exactly what you asked for, it should give you enough clues. http://www.codeproject.com/KB/webforms/datagriddemo.aspx[^]


      only two letters away from being an asset

      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