Read Only DataGrid


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Read Only DataGrid

  1. #1
    Bob Guest

    Read Only DataGrid

    I'm using a DataGrid in a Winforms project to display the results of a
    search. All I want the user to be able to do is to double-click somewhere on
    a row in the grid and then I will display the detail associated with the row.

    I've set the grid columns ReadOnly property which still allows the user to
    enter/change the data in the cell, but restores the original data as soon as
    the user leaves the cell.

    I want to prevent the user from being able to enter/change the data in the
    cell, which means I've got to trap the KeyPress event for each column and eat
    the input by setting e.Handled = True.

    I downloaded the DataGridDigitsTextBoxColumn project in the Winforms info on
    syncfusion.com. My concern is the component inherits DataGridTextBoxColumn
    and invokes a form of the constructor, Public Sub New(PropertyDescriptor,
    String, Boolean), that is documented as "This member supports the .NET
    Framework infrastructure and is not intended to be used directly from your
    code." Microsoft is telling us that if we use this constructor, they reserve
    the right to change/remove it in the future and we are up a creek without a
    paddle.

    I can accept that risk if that is the only way to accomplish what I want to
    do. Is this the only way to eat all input in the cells in a DataGrid?

    Thanks,

    Bob

  2. #2
    Paul Mc Guest

    Re: Read Only DataGrid


    G'day Bob.

    >I've set the grid columns ReadOnly property which still allows the user
    >to enter/change the data in the cell, but restores the original data as
    >soon as the user leaves the cell.

    <Snip/>
    >Is this the only way to eat all input in the cells in a DataGrid?


    You say that you have set the column's ReadOnly property? Try setting the
    ReadOnly property for the grid itself, instead.


    HTH,
    Cheers,
    Paul


  3. #3
    Bob Guest

    Re: Read Only DataGrid

    In article <3d48be44$1@10.1.10.29>, paulmc@nospam.thehub.com.au says...
    >
    > G'day Bob.
    >
    > >I've set the grid columns ReadOnly property which still allows the user
    > >to enter/change the data in the cell, but restores the original data as
    > >soon as the user leaves the cell.

    > <Snip/>
    > >Is this the only way to eat all input in the cells in a DataGrid?

    >
    > You say that you have set the column's ReadOnly property? Try setting the
    > ReadOnly property for the grid itself, instead.
    >
    >
    > HTH,
    > Cheers,
    > Paul


    Paul,

    Thanks! I'm not sure how I missed that property:-( When I first looked at the
    DataGrid, I thought it was strange that there was no ReadOnly property, but
    given all the stuff that MS left out of the grid, I figured that I was
    supposed to make each column ReadOnly.

    Bob - feeling extremely embarrassed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center