gridDataBoundGrid - using as a databound list box

Hi, I want to create a control from gridDataBoundGrid, which will give me similer functionality like a list box(same properties and events). This is because, when no of datarows are more(50K), I observed grid to be faster than listbox. Do we have any such control in place? Or just tell me how to remove all columns headers from gridDataBoundGrid. I will keep asking if i get any more doubts in this custom control creation process..thank you in advance. Rgds Rajani Kanth

8 Replies

AD Administrator Syncfusion Team January 24, 2006 11:24 AM UTC

Hi Badri, You can use a GridListControl like a list box. Refer the sample in Syncfusion\Essential Studio\3.3.0.0\windows\Grid.Windows\Samples\Quick Start\GridListControlSample\ to know about GridListControl. By setting this.gridListControl1.ShowColumnHeader = false; and the this.gridListControl1.MultiColumn = false; you can make it similar like a list box. To hide the headers in the GridDataBoundGrid, set this.gridDataBoundGrid1.Model.Cols.Hidden[0] = true; this.gridDataBoundGrid1.Model.Rows.Hidden[0] = true; Best Regards, Calvin.


BR Badri Rajani Kanth January 24, 2006 02:15 PM UTC

Cool, I am actually working with that. The one main problem i have with that control is NOT having SelectedItems collection. As my user can select any no of items, i need to have a SelectedItems collection which can me Count and All selected objects. Any input plz? Rgds Badri >Hi Badri, > >You can use a GridListControl like a list box. Refer the sample in Syncfusion\Essential Studio\3.3.0.0\windows\Grid.Windows\Samples\Quick Start\GridListControlSample\ to know about GridListControl. By setting this.gridListControl1.ShowColumnHeader = false; and the this.gridListControl1.MultiColumn = false; you can make it similar like a list box. > >To hide the headers in the GridDataBoundGrid, set >this.gridDataBoundGrid1.Model.Cols.Hidden[0] = true; >this.gridDataBoundGrid1.Model.Rows.Hidden[0] = true; > >Best Regards, >Calvin.


BR Badri Rajani Kanth January 24, 2006 02:22 PM UTC

Hi, In addition, we dont have SelectedIndices also. I am using Grid.Selections.Count for SelectedItems.Count. But, when selected items are many, i have problems.. Rgds Rajani Kanth >Cool, > >I am actually working with that. >The one main problem i have with that control is NOT having SelectedItems collection. As my user can select any no of items, i need to have a SelectedItems collection which can me Count and All selected objects. Any input plz? > >Rgds >Badri > >>Hi Badri, >> >>You can use a GridListControl like a list box. Refer the sample in Syncfusion\Essential Studio\3.3.0.0\windows\Grid.Windows\Samples\Quick Start\GridListControlSample\ to know about GridListControl. By setting this.gridListControl1.ShowColumnHeader = false; and the this.gridListControl1.MultiColumn = false; you can make it similar like a list box. >> >>To hide the headers in the GridDataBoundGrid, set >>this.gridDataBoundGrid1.Model.Cols.Hidden[0] = true; >>this.gridDataBoundGrid1.Model.Rows.Hidden[0] = true; >> >>Best Regards, >>Calvin.


ST stanleyj Syncfusion Team January 24, 2006 03:25 PM UTC

Hi Badri, Check out this article, this may help. Best regards, Stanley


BR Badri Rajani Kanth January 24, 2006 04:13 PM UTC

Hi, This article is about dataBoundGrid. And also, I am looking to retrieve objects from SelectedItems Count of GridListControl. Plz inform me if any related samples/articles exists.. Rgds Badri >Hi Badri, > >Check out this article, this may help. > >Best regards, >Stanley


BR Badri Rajani Kanth January 24, 2006 04:40 PM UTC

Hi, Ideally I want to store and retrieve daraRows/dataRowViews and retrieve the same from GridListControl. If i just go by text property, i can have many duplicates. Rgds Rajani Kanth >Hi, >This article is about dataBoundGrid. And also, >I am looking to retrieve objects from SelectedItems Count of GridListControl. Plz inform me if any related samples/articles exists.. >Rgds >Badri > >>Hi Badri, >> >>Check out this article, this may help. >> >>Best regards, >>Stanley


BR Badri Rajani Kanth January 24, 2006 05:01 PM UTC

Hi, I am trying with below code. Is this OK? foreach(Syncfusion.Windows.Forms.Grid.GridRangeInfo range in list) { for(int i = range.Top; i <= range.Bottom; i++) { DataRowView dataRowView = this.gridListControl1.Items[i-1] as DataRowView; string firstName = dataRowView.Row["FirstName"].ToString(); //DisplayMember string lastName = dataRowView.Row["LastName"].ToString(); //ValueMember System.Diagnostics.Debug.WriteLine(firstName + ":" + lastName); } } .. Plz confirm.. Rgds Rajani Kanth >Hi, >Ideally I want to store and retrieve daraRows/dataRowViews and retrieve the same from GridListControl. If i just go by text property, i can have many duplicates. > >Rgds >Rajani Kanth > > > > >>Hi, >>This article is about dataBoundGrid. And also, >>I am looking to retrieve objects from SelectedItems Count of GridListControl. Plz inform me if any related samples/articles exists.. >>Rgds >>Badri >> >>>Hi Badri, >>> >>>Check out this article, this may help. >>> >>>Best regards, >>>Stanley


AD Administrator Syncfusion Team January 25, 2006 09:00 AM UTC

Hi Badri, Yes, you can retrieve the selected rows as mentioned and you can also add a row to the grid by just adding it to the Table. Below is the code snippet. DataTable dt = (DataTable)this.gridListControl1.DataSource; DataRow dr = dt.NewRow(); dr[0]="John"; dr[1]="Knox"; dt.Rows.Add(dr); Regards, Calvin.

Loader.
Up arrow icon