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. General Programming
  3. C#
  4. dataGrid SelectedIndexChanged Method not available in Compact Framework

dataGrid SelectedIndexChanged Method not available in Compact Framework

Scheduled Pinned Locked Moved C#
css
4 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.
  • P Offline
    P Offline
    Paulo Mitchell
    wrote on last edited by
    #1

    I have an application running on a PDA that currently uses the OnClick Event of a DataGrid to perfortm some functionality. I would like to have the same functionality run when the current row of my DataGrid is highlighted (by the user scrolling ro it instead of clicking on it). The method to use would seem to be OnSelectedIndexChanged but this does not seem to be available in the Compact Framework (3.5). I The OnGotFocus doesn't seem to be suitable either (I guesss that this is because it applies to the DataGrid itself and not the row). Can anyone suggest how I can get this to work. Note that I only want the event to fire when the user moves to the row and not when the grid is populated. Thanks

    M 1 Reply Last reply
    0
    • P Paulo Mitchell

      I have an application running on a PDA that currently uses the OnClick Event of a DataGrid to perfortm some functionality. I would like to have the same functionality run when the current row of my DataGrid is highlighted (by the user scrolling ro it instead of clicking on it). The method to use would seem to be OnSelectedIndexChanged but this does not seem to be available in the Compact Framework (3.5). I The OnGotFocus doesn't seem to be suitable either (I guesss that this is because it applies to the DataGrid itself and not the row). Can anyone suggest how I can get this to work. Note that I only want the event to fire when the user moves to the row and not when the grid is populated. Thanks

      M Offline
      M Offline
      MickCurley
      wrote on last edited by
      #2

      Just use the Mouse or Click Events exposed by the datagrid. and get its CurrentRowIndex. You may have to bind the datagrid datasource using the CurrencyManager. Then just build a DataRowView from it. I'm not sure if this is what you are asking. BTW. you should post this in Mobile Development. Regards M Curley. :)

      P 1 Reply Last reply
      0
      • M MickCurley

        Just use the Mouse or Click Events exposed by the datagrid. and get its CurrentRowIndex. You may have to bind the datagrid datasource using the CurrencyManager. Then just build a DataRowView from it. I'm not sure if this is what you are asking. BTW. you should post this in Mobile Development. Regards M Curley. :)

        P Offline
        P Offline
        Paulo Mitchell
        wrote on last edited by
        #3

        The problem is that I will not be clicking on the grid so the onClick event won't fire. I will just be using the button thing at the bottom of the PDA ro scroll down the list. I was looking for an event that would fire when the row was highlighted. The SelectedIndexChanged looked like the one for me but that doesn't seem to be available in the Compact Framework. I will post this again on the Mobile Development board and make my question a bit clearer. Thanks for your reply anyway.

        M 1 Reply Last reply
        0
        • P Paulo Mitchell

          The problem is that I will not be clicking on the grid so the onClick event won't fire. I will just be using the button thing at the bottom of the PDA ro scroll down the list. I was looking for an event that would fire when the row was highlighted. The SelectedIndexChanged looked like the one for me but that doesn't seem to be available in the Compact Framework. I will post this again on the Mobile Development board and make my question a bit clearer. Thanks for your reply anyway.

          M Offline
          M Offline
          MickCurley
          wrote on last edited by
          #4

          Create an integer variable. Then load the datagrid and select the first row by using

          dataGrid.Select(0)

          Then capture the up and down keys on the form and increment or decrement this variable and pass this to the dataGrid

          dataGrid.Select(your_variable_here)

          Would this not achieve what you want to do?

          Regards Mick Curley :)

          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