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

Drop Down Grids

Thread ID:

Created:

Updated:

Platform:

Replies:

805 Aug 20,2002 01:06 PM Aug 23,2002 07:09 AM Windows Forms 9
loading
Tags: GridControl
Rachel York
Asked On August 20, 2002 01:06 PM

How do you assign a custom grid to appear on clicking the button in a cell with the type "DropDownGrid"?

Clay Burch [Syncfusion]
Replied On August 20, 2002 05:03 PM

Currently, there is no way to do this without deriving a cell control. The attached sample shows one way to go about this.

Rachel York
Replied On August 21, 2002 07:15 AM

> Currently, there is no way to do this without deriving a cell control. The attached sample shows one way to go about this. The zip file posted does not contain Form1.resx file. Can you please post this also? Thanks!

Clay Burch [Syncfusion]
Replied On August 21, 2002 09:03 AM

You can let VS.NET regenerate that resx file (this way it will use the proper references on your system). At the top of Solutions Explorer, click the Show all Files button. Then open the Form1 node to see the resx file. Then right click the resx file, and delete it. Then if you open the form in the designer and make a change, this file will be regenerated. Let me know if this does not work, and I'll post one, but I think letting the VS regenerate it is best.

Rachel York
Replied On August 21, 2002 12:04 PM

> You can let VS.NET regenerate that resx file (this way it will use the proper references on your system). > > At the top of Solutions Explorer, click the Show all Files button. Then open the Form1 node to see the resx file. Then right click the resx file, and delete it. Then if you open the form in the designer and make a change, this file will be regenerated. > > Let me know if this does not work, and I'll post one, but I think letting the VS regenerate it is best. I got the DropDownGridCell class that was posted for to work to display custom grids in the popup window. Now I have a question about sizing the popup grid that appears. I see in the DropDownGridCell code where this.dropdownContainer.PopupHost.Size = new Size(350, 200); sets the size of the popup window. I would like that popup window to be the size of the grid. Seems simple enough - just replace the above line with this.dropdownContainer.PopupHost.Size = grid.Size; However, I am resizing the popup grid on the CellButtonClicked event of the original grid control. So, when the button is clicked in the original grid I custom size the popupgrid. Then the DropDownGridCell.DropDownContainerShowingDropDown() event is called. However, when i get in this event the popup grid's size has now reverted back to the default size - losing the sizing changes made on the CellButtonClicked event. Any ideas?

Clay Burch [Syncfusion]
Replied On August 21, 2002 03:27 PM

You can make the size of the dropdown a public property of the renderer class, and use this property in the DropDownContainerShowingDropDown to set the size of the dropdown. Then in the CellButtonClicked event, you can set this public property to the size you want it to be. To get at the renderer object in your CellButtonClicked handler, use code such as: DropDownGridCellRenderer renderer = (DropDownGridCellRenderer)this.gridControl1.CellRenderers["GridADropCell"]; Or, you could get at try to get the renderer through the CurrentCell. DropDownGridCellRenderer renderer = (DropDownGridCellRenderer)this.gridControl1.CurrentCell.Renderer; Maybe something like this would work for you...

Rachel York
Replied On August 22, 2002 10:55 AM

Thanks for the help so far. I have another question... When I click on the drop down button in my cell, the drop down grid opens but the text that is in that cell disappears. Then, once the drop down grid is closed the text is still gone. It does not reappear until I click into another cell...

Rachel York
Replied On August 22, 2002 01:44 PM

I'm having a problem with unwanted/unnecessary scroll bars appearing in my drop down grid. I used the techniques that were suggested about to size the popup window to the same size as my grid. It worked great however there is one slight problem that i am having. The first time i click on the drop down button and i am dropping down a grid with more than 1 line scroll bars appear. The next time i click on the button the scroll bars are not there. However both times the popup window and the grid are sized perfectly. Oddly enough the drop down grid works fine when popping up a custom sized grid with a rowcount of 1. public override void DropDownContainerShowingDropDown(object sender, CancelEventArgs e) { this.dropdownContainer.AutoScroll = false; this.dropdownContainer.PopupHost.AutoScroll = false; this.dropdownContainer.Size = _PopupSize; this.dropdownContainer.PopupHost.Size = _PopupSize; this.dropdownContainer.PopupHost.FormBorderStyle = FormBorderStyle.FixedSingle; this.dropdownContainer.Parent.Size = _PopupSize; this.dropdownContainer.Dock = DockStyle.Fill; this.dropdownContainer.IgnoreDialogKey = true; if (grid == null) { grid = Grid.CreateNewControl(this.dropdownContainer, 0, 0) as GridControlBase; grid.Dock = DockStyle.Fill; } grid.VScroll = false; grid.HScroll = false; grid.HScrollBar.Enabled = false; grid.VScrollBar.Enabled = false; grid.Parent = this.dropdownContainer; grid.Visible = true; this.dropdownContainer.Controls.Add(grid); base.DropDownContainerShowingDropDown(sender, e); } As you can see i have tried as much as i can think of to stop the scroll bars from appearing. Please help! Thanks in advance!

Clay Burch [Syncfusion]
Replied On August 22, 2002 05:51 PM

Without seeing a working sample to debug, I am just throwing out ideas for you to try. You might just enlarge your dropdown by 50 pixels in each dimension to see if you are off by a pixel or two causing the scrollbars to appear. If the larger dropdown works, then you might be missing borders or something. You can also call GridControl.UpdateScrollBars from your code to force the scrollbars to be updated say after the call to base.DropDownContainerShowingDropDown (or maybe before it).

Clay Burch [Syncfusion]
Replied On August 23, 2002 07:09 AM

I looked at trying to set the size of the dropdown based on the grid size in CellButtonClick. There is a recursive type problem in trying to do this: First, you have to actually set the grid.Size to what you want it to be when you create the grid (the code was not doing this) so you can use this grid.Size to set the dropdown size in CellButtonClick. But then, the dropdown takes this size and sizes itself. Then, since the grid is dock.Filled inside the dropdown, this caused the grid.Size to be changed. Thus the next time you hit CellButtonClick, we have a slightly smaller grid to work with, and so on. One solution is not to use grid.size in your CellButtonClick, but instead use some added property that was initially set using the gridsize you want, but then is no longer dependent upon the gridsize (so it avoids the recursion).

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

;