Home Forums WinForms controls Xceed Grid for WinForms Which is best to use? Unbounded or databound grid?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17076 |

    Hello all,

    Here is what I am doing/wanting to do.  Data is selected from my DB (Postgres).  I am thinking of loading each record into a class, then into an arraylist.  The class has Attributes on each Property (DisplayName & FieldName).  I am going to use that info to create a Column Selection popup, so the user can select/deselect which columns to view.  I was thinking of using an unbounded grid and create the columns based on what the user wants, then show the data.

    Does that sound reasonable?  Too cumbersome? Is there a better way?

    Regards,

    Chuck 

    Imported from legacy forums. Posted by Chuck (had 1930 views)

    User (Old forums)
    Member
    Post count: 23064

    For managing the column, it is ok, but it means you must load the data manually in each row which can become cumbersome.

    If you can bind direct to the DB via a DataSet generated by .NET, then you could simply use the Visible property on each column that is automatically generated by the gird, which is really the simplest way.

    However, if you do not want to have all the unnecessary columns created, you can still bind the grid to the DataSet, and set the AutoCreateColumns property on the GridControl to false.  Then provide only the columns you need through the use of the DataBoundColumn class.  Just make sure to use the same name for the columns that are used in the DB when you instantiate them.  All fields with no corresponding columns in the grid will NOT be created.

    Imported from legacy forums. Posted by André (had 1862 views)

    User (Old forums)
    Member
    Post count: 23064

    hey mate,

    I think André gave fantastic suggestion and dont want to argue on that, but I had major memory issue by doing that.

    so I took different approach. 

    I use XML to create ColumnManagerRow as following:

    <DataStructure>
      <field cellName=”surname” displayName=”Surname” cellSize=”50″ dataType=”string” visitbleState=”true” displayOrder=”1″ alignment=”left” />

    ….

    </DataStructure>
     

    and then used custom methods to create columns in the grid.

    This helped me a lot to reduce unnecessary data objects holding in the memory as well as I get to control what goes into grid and what not.

    You can attach all your events design time and once you create TempalteDataRow use that to insert data with whichever format you want.

    It basically allows you to design something really generic as well as managable.

    Again, binding is not bad at all. this is just an alternative for someone to use.

    NR

    Imported from legacy forums. Posted by NR (had 326 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello NR,

    Thank you for your response.  Yes, Andre’s suggestion was excellent and I see how I can implement that.

    I do have a question on the way you are doing things.  Trying to get a little more detail.

    First, I like the idea of having XML hold the grid info.  That way I can save it in the DB, each user can have their own grids.

    Okay, so, with the XML, you read through it and build the columns, then based on the columns that are visible, you go out to where the data is stored and retrieve that data.  Once you get the data you walk through it and manually add the rows and columns?  Is that correct? 

     Regards,

    Chuck 

    Imported from legacy forums. Posted by Chuck (had 281 views)

    User (Old forums)
    Member
    Post count: 23064

    yes that is possible, what it will allow you to do is freedom from you designing something.

     

    user can store their pref and u can make that happen. cols will be loaded from xml n then you can add dataRow template style as a row n insert whatever rows u want. 

    NR 

    Imported from legacy forums. Posted by NR (had 2412 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.