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. Not able to set focus on the grid

Not able to set focus on the grid

Scheduled Pinned Locked Moved C#
8 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.
  • S Offline
    S Offline
    Sivaprasad C
    wrote on last edited by
    #1

    Hi, I am using a third party data grid in my page...I am not able to set focus on the grid when I tab out from textbox control placed before the grid.Please help

    Regards, Sivaprasad

    S 1 Reply Last reply
    0
    • S Sivaprasad C

      Hi, I am using a third party data grid in my page...I am not able to set focus on the grid when I tab out from textbox control placed before the grid.Please help

      Regards, Sivaprasad

      S Offline
      S Offline
      Stevo Z
      wrote on last edited by
      #2

      Hi, I'm not a web expert (I suppose you're talking about web development), but how do you thing can focus a data grid ? It is not a control, it's just a table with bunch of labels, texboxes and links in it.

      S 1 Reply Last reply
      0
      • S Stevo Z

        Hi, I'm not a web expert (I suppose you're talking about web development), but how do you thing can focus a data grid ? It is not a control, it's just a table with bunch of labels, texboxes and links in it.

        S Offline
        S Offline
        Sivaprasad C
        wrote on last edited by
        #3

        i am talking about a grid in my windows application....It has 3 - 4 cells in each row..I want the focus to be in the first cell of the first row

        Regards, Sivaprasad

        S 1 Reply Last reply
        0
        • S Sivaprasad C

          i am talking about a grid in my windows application....It has 3 - 4 cells in each row..I want the focus to be in the first cell of the first row

          Regards, Sivaprasad

          S Offline
          S Offline
          Stevo Z
          wrote on last edited by
          #4

          Well, ok. It's a third party datagrid. Do you have sourcecode that u can change to make it work your way? If yes, how do you know that the control doesn't have focus. It may have focus but if it is customly drawn it's proboble that it just doesn't change (visual side) when recieved focus. If you have sourcecode just override void OnGotFocus(EventArgs e) method and make it focus the first cell in the first row. That will cause, of course, allways when you click on that control focusing that cell. There is way to change it (i.e. if you dont want to put the focus on first cell when mouseclicked, only when tabbed). Anyway , do you have source code? If not i guess, there is not much u can do about it...

          S 1 Reply Last reply
          0
          • S Stevo Z

            Well, ok. It's a third party datagrid. Do you have sourcecode that u can change to make it work your way? If yes, how do you know that the control doesn't have focus. It may have focus but if it is customly drawn it's proboble that it just doesn't change (visual side) when recieved focus. If you have sourcecode just override void OnGotFocus(EventArgs e) method and make it focus the first cell in the first row. That will cause, of course, allways when you click on that control focusing that cell. There is way to change it (i.e. if you dont want to put the focus on first cell when mouseclicked, only when tabbed). Anyway , do you have source code? If not i guess, there is not much u can do about it...

            S Offline
            S Offline
            Sivaprasad C
            wrote on last edited by
            #5

            As u say 'It may have focus but if it is customly drawn it's proboble that it just doesn't change (visual side) when recieved focus.' here I am losing the focus that means I am not able to get the fous on any control after the third party grid when I tab out

            Regards, Sivaprasad

            S 1 Reply Last reply
            0
            • S Sivaprasad C

              As u say 'It may have focus but if it is customly drawn it's proboble that it just doesn't change (visual side) when recieved focus.' here I am losing the focus that means I am not able to get the fous on any control after the third party grid when I tab out

              Regards, Sivaprasad

              S Offline
              S Offline
              Stevo Z
              wrote on last edited by
              #6

              first u told that u are not able to focus the grid, resp. first cell on the grid. now u telling that u are not able to pass focus further from the grid ? U cannot loose focus. It just somewhere (probobly on the grid and it is not displayed). But u haven't answered my question. Do you have source code?

              S 1 Reply Last reply
              0
              • S Stevo Z

                first u told that u are not able to focus the grid, resp. first cell on the grid. now u telling that u are not able to pass focus further from the grid ? U cannot loose focus. It just somewhere (probobly on the grid and it is not displayed). But u haven't answered my question. Do you have source code?

                S Offline
                S Offline
                Sivaprasad C
                wrote on last edited by
                #7

                I told that I am not able to focus on the grid, WHICH IS MY PROBLEM. But u told that focus will be ther but we cant viwe it ...thatz y I told that if focus is there and we cant view it the focus should atleast pass to the next control after the grid when I tab out rite?? I hope u understood my probl;em No I dont have the source code.

                Regards, Sivaprasad

                S 1 Reply Last reply
                0
                • S Sivaprasad C

                  I told that I am not able to focus on the grid, WHICH IS MY PROBLEM. But u told that focus will be ther but we cant viwe it ...thatz y I told that if focus is there and we cant view it the focus should atleast pass to the next control after the grid when I tab out rite?? I hope u understood my probl;em No I dont have the source code.

                  Regards, Sivaprasad

                  S Offline
                  S Offline
                  Stevo Z
                  wrote on last edited by
                  #8

                  Now I understand :). Generally speaking if your grid is derived from System.Windows.Forms.Control, it can recieve focus. If that control has focus and tab is pressed, any child controls inside will be focused. After last child control is focused, focus is passed to another control (on same level as your datagrid). If your Datagrid is derived from System.Windows.Forms.UserControl, it won't recieve focus, only it's children. This is default behaviout which can be changed and it's really hard to help you if u cannot change the source code. There is one thing u can do. U can hook on GotFocus event of your datagrid. Whenn triggered, try to browse child controls of that grid and focus first one(or maybe first one of type TextBox) . But that may not work at all, depends on implementation of that datagrid... hope that helps...

                  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