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. Image for the cookie policy date

Binding a text box cell of a GridControl

I am using the trial version of the Essential Grid control. I want to bind a column of a datasource in a cell into a GridControl. The way i do this is: this.myGridControl[0,1].CellType = "TextBox"; this.myGridControl[0,1].DataSource = myDataSet; this.myGridControl[0,1].DisplayMember = "myDataSet.Name"; // The column of the the table this.gridControl1[0,1].ValueMember = "myDataSet.Name"; I can'' t see anything in the cell. My final scope is to bind some cells of the grid with columns of the datasource and to do a record navigation. It'' s possible to do that? Areti

3 Replies

AD Administrator Syncfusion Team October 21, 2004 08:02 AM

The grid does not support simple binding to a single grid cell. The style.DataSource, style.DisplayeMember, style.ValueMember are used for complex binding to cells with celltype=ComboBox or celltype=GridListControl. In this case, the databinding provides the list for these dropdowns just as with the standard Windows Forms ComboBox control. If you want to use this binding to show foreign keys in what looks like a textbox, you can set the style.CellType = "ComboBox" and also set style.ShowButtons = GridShowButtons.None.


AS Areti Stamatourou October 21, 2004 11:37 PM

Good Morning Clay Thanks for your response. I have done your solution but i don''t see anything in the field. How can i set the list index of the combo box? And i can combine the fields of the grid with a record navigation control? >The grid does not support simple binding to a single grid cell. The style.DataSource, style.DisplayeMember, style.ValueMember are used for complex binding to cells with celltype=ComboBox or celltype=GridListControl. In this case, the databinding provides the list for these dropdowns just as with the standard Windows Forms ComboBox control. If you want to use this binding to show foreign keys in what looks like a textbox, you can set the style.CellType = "ComboBox" and also set style.ShowButtons = GridShowButtons.None. >


AD Administrator Syncfusion Team October 22, 2004 02:48 AM

>I have done your solution but i don''t see anything in the field. This sample, Grid\Samples\DataBound\GDBGcombos, shows databound comboboxes in a griddataboundgrid. It was done entirely with the designer, so to see the code involved, you would look at the designer generated code. There is also this sample that shows how to set up comboboxes from code. Grid\Samples\CellTypes\ComboboxCells. >How can i set the list index of the combo box? Normally, you do not set the index, but instead set the value that should be seen in the grid cell. (The grid generally works with the cell values, and not indexes in the droplist. The only time the grid maintains knowledge of these indexes is when the grid is actually displaying the dropdown (more or less)). >And i can combine the fields of the grid with a record navigation control? The default support is to navigate rows, not fields. See this sample. Grid\Samples\DataBound\RecordNavDataBoundGrid If you can post a little sample project showing how you are trying to set up up your combobox cell, we can try to spot the problem here.

Loader.
Live Chat Icon For mobile
Up arrow icon