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. readonly DataGrid

readonly DataGrid

Scheduled Pinned Locked Moved C#
question
9 Posts 3 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.
  • G Offline
    G Offline
    goldoche
    wrote on last edited by
    #1

    Hi everyone, I have this read-only DataGrid (ReadOnly property set to true), but when the user selects a cell by clicking on it, the text of the cell is automatically selected, as if it could be edited. How can I do something more like a ListView, without this text selection? Thanks!

    M P 2 Replies Last reply
    0
    • G goldoche

      Hi everyone, I have this read-only DataGrid (ReadOnly property set to true), but when the user selects a cell by clicking on it, the text of the cell is automatically selected, as if it could be edited. How can I do something more like a ListView, without this text selection? Thanks!

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

      You want read only datagrid or no selection on datagrid text? Because, you can also select text on read only datagrid.

      G 1 Reply Last reply
      0
      • M mehmetned

        You want read only datagrid or no selection on datagrid text? Because, you can also select text on read only datagrid.

        G Offline
        G Offline
        goldoche
        wrote on last edited by
        #3

        "without this text selection" I don't want any text selection to occur when I select cells on my DataGrid.

        1 Reply Last reply
        0
        • G goldoche

          Hi everyone, I have this read-only DataGrid (ReadOnly property set to true), but when the user selects a cell by clicking on it, the text of the cell is automatically selected, as if it could be edited. How can I do something more like a ListView, without this text selection? Thanks!

          P Offline
          P Offline
          Pualee
          wrote on last edited by
          #4

          Change SelectionMode to FullRowSelect Now when the user selects a row, the entire thing is highlighted. They are unable to select the text of individual cells. Pualee

          G 1 Reply Last reply
          0
          • P Pualee

            Change SelectionMode to FullRowSelect Now when the user selects a row, the entire thing is highlighted. They are unable to select the text of individual cells. Pualee

            G Offline
            G Offline
            goldoche
            wrote on last edited by
            #5

            The DataGrid doesn't have a SelectionMode property.

            P 2 Replies Last reply
            0
            • G goldoche

              The DataGrid doesn't have a SelectionMode property.

              P Offline
              P Offline
              Pualee
              wrote on last edited by
              #6

              Sorry, I must not have read closely. Is there any reason you are using the DataGrid instead of the DataGridView? I know there are a lot of enhancements made, but am unfamilar with anything pre 2.0 Framework at this time. Pualee

              G 1 Reply Last reply
              0
              • G goldoche

                The DataGrid doesn't have a SelectionMode property.

                P Offline
                P Offline
                Pualee
                wrote on last edited by
                #7

                Looking briefly, I don't see a similar property on the DataGrid. Maybe someone else could help you there. However, you could try the following to get a similar effect: Override the SelectedIndexChanged event so that it sets the index on the row selected (overriding the cell selection) with the SelectedIndex property. As a disclaimer, I really don't know if this would unselect the cell. Pualee

                1 Reply Last reply
                0
                • P Pualee

                  Sorry, I must not have read closely. Is there any reason you are using the DataGrid instead of the DataGridView? I know there are a lot of enhancements made, but am unfamilar with anything pre 2.0 Framework at this time. Pualee

                  G Offline
                  G Offline
                  goldoche
                  wrote on last edited by
                  #8

                  Well I have Visual Studio 2003 and I work with Framework 1.1. Is there an easy way of using Framework 2.0 without buying VS 2005? Thank you!

                  P 1 Reply Last reply
                  0
                  • G goldoche

                    Well I have Visual Studio 2003 and I work with Framework 1.1. Is there an easy way of using Framework 2.0 without buying VS 2005? Thank you!

                    P Offline
                    P Offline
                    Pualee
                    wrote on last edited by
                    #9

                    Did you try the method I put in the reply below using the event? I would suggest researching further using the DataGrid if you are in 2003, but if you are interested in framework 2.0 ... I think the download for the framework is free so you could always build everything programatically using a text editor. Since you likely won't want to do that you could try the Visual C# 2005 Express Edition which is free, but has a few limitations. Finally, you could try downloading the 2.0 framework and using it with the 2003 IDE, but I do not know what side effects you would see there. If you are using 1.1, I assume your clients are expected to have 1.1 installed as well. If you change to 2.0, you would also change your runtime requirements for your clients, which I am not sure you want to do. Also, I have no idea what the licensing requirements will be if you ever plan to deploy your application. Pualee

                    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