We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to control the height of the GridListControl in DataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

7901 Oct 14,2003 12:15 PM UTC Oct 17,2003 05:46 AM UTC Windows Forms 10
loading
Tags: GridControl
Fred Kwok
Asked On October 14, 2003 12:15 PM UTC

Hi All, I have a DataBoundGrid containning a column of cell with celltype of GridListControl. I want to know how to control the size of the dropdown GridListControl? Say fix the height of the dropdown GridListControl to make the dropdown display 10 records at without a scrollbar Please help. Thanks in advance, Fred

Administrator [Syncfusion]
Replied On October 14, 2003 03:45 PM UTC

The same GridListControl is used for every GridListControl in any cell. So, you would want to set this rows of rows for each drop of the list since potentially every cell may have a different list. Try this CurrentCellShowingDropDown event.
Private Sub GridDataBoundGrid1_CurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridCurrentCellShowingDropDownEventArgs)  Handles GridDataBoundGrid1.CurrentCellShowingDropDown
	Dim cc As GridCurrentCell = Me.GridDataBoundGrid1.CurrentCell
	If cc.Renderer.GetType() Is GetType(GridDropDownGridListControlCellRenderer) Then
		Dim cr As GridDropDownGridListControlCellRenderer = CType(cc.Renderer, GridDropDownGridListControlCellRenderer)
		cr.ListControlPart.DropDownRows = 12 
	         cr.ListControlPart.AutoSizeColumns = True
	End If
End Sub

Fred Kwok
Replied On October 14, 2003 11:17 PM UTC

I have try this before, but it didn't works In your code, "cr.ListControlPart.DropDownRows" gives Error of 'DropDownRows is not a member of Syncfusions.Windows.Form.Grid.GridListControl' So I 'ctype' it to before following... Dim cc As GridCurrentCell = Me.GridDataBoundGrid1.CurrentCell If cc.Renderer.GetType() Is GetType(GridDropDownGridListControlCellRenderer) Then Dim cr As GridDropDownGridListControlCellRenderer = CType(cc.Renderer, GridDropDownGridListControlCellRenderer) CType(cr.ListControlPart, GridDropDownGridListControlPart).DropDownRows = 12 CType(cr.ListControlPart, GridDropDownGridListControlPart).AutoSizeColumns = True Dim dv As New DataView(DsCustItemSpace1.Branch) dv.RowFilter = String.Format("[CompID] = {0}", Val(Me.GridDataBoundGrid1(cc.RowIndex, iMasterColumn).CellValue)) CType(cr.ListControlPart, GridDropDownGridListControlPart).DataSource = dv End If But i Still can't set the size of the dropdown Any comments?

Administrator [Syncfusion]
Replied On October 15, 2003 06:01 AM UTC

Sorry about missing the cast. I think your code should work. Attached is a sample project that drops 3 rows in cell 2,2 and 5 rows in cell 2,3 using code similar to yours. The sample also dynamically filters the droplist using a technique similar to what you have in your code snippet.

Fred Kwok
Replied On October 15, 2003 11:39 AM UTC

Thanks for your reply again. Yes. I agree that your example works fine. But my problem is on databoundgrid, while you are using a normal grid. Could you mind to take a look at my attached example? Please correct me, if i did anything wrong.

Administrator [Syncfusion]
Replied On October 15, 2003 02:25 PM UTC

The grid counts teh row header column as column 0. So, try changing your code from If cc.ColIndex = 1 Then to If cc.ColIndex = 2 Then With that change your sample dropped 10 rows for me.

Fred Kwok
Replied On October 15, 2003 11:05 PM UTC

Oh...Sorry... I did a stupid misstake in my example... Thanks for your correction. I still have a little question on that. If i change the "Dim iRows As Integer = 10" to "Dim iRows As Integer = 3" with DropDownRows = 10 In this case, the drop down only show 2 rows at a time. I find that, if the total number of rows available is equal to or smaller than the DropDownRows property value. Then the dropdown will function abnormally. I find that in most case, the dropdown can only show iRows-1 records at a time. User need to use scroll bar to view the remainning one. Any Commets?

Administrator [Syncfusion]
Replied On October 16, 2003 08:28 AM UTC

Setting cr.ListControlPart.FillLastColumn = True will take care of a lot of these kinds of problems. You can also set the e.Size parameter so that it exactly fits the width of the droplist to avoid scrollbar problems. Attached is your sample showing such code.

Fred Kwok
Replied On October 16, 2003 01:42 PM UTC

Great...It works now... Thank you very much, you are very helpful... ^_^

Fred Kwok
Replied On October 16, 2003 11:21 PM UTC

Although it works fine, a lot of extra coding i need to make it works. I think this is a fairly common function. Will this function be included in Version 2.0 And I want to know, where can I find the detail documentation of the grid.

Administrator [Syncfusion]
Replied On October 17, 2003 05:46 AM UTC

There is no change with respect to the behavior in 2.0. The grid's class reference should have been installed when you installed the productand be available from within DevStu. Make sure you set your help filter to none to see it.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;