Grid shows all columns even when not selected

Not Answered This post has 0 verified answers | 10 Replies | 3 Followers Thread's RSS feed.

Linija
Points 110
Replied On: Fri, Aug 11 2017 7:10 AM Reply

I have binded the Grid to the Datasource using the Designer , there i selected the number of columns to be displayed but on giving the adapter.fill method , it returns all the columns

  • Post Points: 20

All Replies

Sahaja Kokkalagadda
Points 4,995
Infragistics Employee
Replied On: Fri, Aug 11 2017 4:37 PM Reply


Hello Linija,

When binding a DataSource to a Grid through designer, if you have selected specific columns then the DataAdapter.Fill method will only render those columns in the Grid. I have tested this behavior and it is working like I described. In order to resolve this issue, try calling the below line of code to clear the DataAdapter before filling it:

  this.categoriesTableAdapter.ClearBeforeFill = true;

Please try the above suggestion and let me know if I may be of further assistance.

Sincerely,
Sahaja Kokkalagadda
Associate Software Developer

  • Post Points: 20
Linija
Points 110
Replied On: Sun, Aug 13 2017 3:26 PM Reply

Hello Sahaja

Thanks for the update , but the problem still exists, please see the attachment . I really dont understand where the problem is.

  • Post Points: 20
Sahaja Kokkalagadda
Points 4,995
Infragistics Employee
Replied On: Mon, Aug 14 2017 9:52 PM Reply

Hello Linija,

There are two possible ways to select and render only certain columns in UltraGrid.

Method1: At run time, create unbound Grid columns and hide the unwanted columns by looping through them in Grid’s InitializeLayout event. This is the simple and recommended way to achieve this.

Method2: At design time, bind the Grid to a DataSource and create the required columns as unbound columns (with same DataType as DataSource).
Note: Make sure the unbound columns band name matches with the DataSource band name.

Please use one of the above approaches to resolve this issue and let me know if you have any questions.

Sincerely,
Sahaja Kokkalagadda
Associate Software Developer

  • Post Points: 35
Mike Saltzman
Points 464,890
Infragistics Employee
Replied On: Tue, Aug 15 2017 9:15 AM Reply

Here's an article with details on how to accomplish the second approach: 

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=6702

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 5
Linija
Points 110
Replied On: Mon, Aug 21 2017 3:28 AM Reply

I have tried the second method binding the grid to sp , still it returns all columns.Please see the attachment

  • Post Points: 20
Mike Saltzman
Points 464,890
Infragistics Employee
Replied On: Mon, Aug 21 2017 9:16 AM Reply

Did you read the article I posted and make sure that your layout matches the data source you bind to at run-time? The most common mistake people make is forgetting to set the Key on the band. If it doesn't match, then the grid's layout will be lost at run-time. 

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
Linija
Points 110
Replied On: Mon, Aug 21 2017 9:54 AM Reply

Is this the one you are refering to ?

  • Post Points: 5
Linija
Points 110
Replied On: Mon, Aug 21 2017 9:56 AM Reply

Please see the attachment

  • Post Points: 5
Linija
Points 110
Replied On: Mon, Aug 21 2017 10:09 AM Reply

At design time , only my specified columns appear but on run time the unspecified columns start after the specified columns

  • Post Points: 20
Mike Saltzman
Points 464,890
Infragistics Employee
Replied On: Mon, Aug 21 2017 12:17 PM Reply

It looks like you are editing the Columns collection of the band via the property grid. That won't work. You have to use the grid designer and manually define the schema. If you follow the instructions in the KB article I posted above, it walks you through it step by step. 

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 5
Page 1 of 1 (11 items) | RSS