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

GridControl and ComboBox column VB.Net 2005

version 5.102.1.0

I am trying to populate a column's combobox with data at runtime. The grid will be a user maintainable grid, meaning, the user has to input data and click an outside button that will send the grid's data to SQL Server. The first column is a combobox that has been prefilled with data when the form first loads. Lots of the examples I have downloaded have not helped.

8 Replies

JA James August 24, 2007 12:31 PM UTC

ok... this worked
Grid.ColStyles.Item(intCol).DataSource = dt
Grid.ColStyles.Item(intCol).DisplayMember = RetField
Grid.ColStyles.Item(intCol).ValueMember = RetField

now I am having a problem with the combo's behavior. I need to allow user typing... but what is typed must be valid in the combobox.


>version 5.102.1.0

I am trying to populate a column's combobox with data at runtime. The grid will be a user maintainable grid, meaning, the user has to input data and click an outside button that will send the grid's data to SQL Server. The first column is a combobox that has been prefilled with data when the form first loads. Lots of the examples I have downloaded have not helped.


J. J.Nagarajan Syncfusion Team August 24, 2007 11:09 PM UTC

Hi James,

Thanks for your interest in Syncfusion product.

We glad to hear that your previous issue has been resolved. If you want to allow the user to type the valid test in the combobox then you have to set GridDropDownStyle to AutoComplete. Please refer to the following code snippet

Grid.ColStyles.Item(intCol).DropDownStyle=GridDropDownStyle.AutoComplete

I hope this will meet your requirement. Please let me know if you have any questions.

Thanks,
Nagaraj


JA James August 27, 2007 12:03 PM UTC

I have been able to set the dropdown to editable with autocomplete enabled. I would like to see if there is a "validation" event or somthing that is triggered when the user has typed a valid selection. Once the user has inputed a value that is in the list, I intend to populate other fields in the row with queries from SQL. So far, I have been able to trap for the Enter key press, but would like to know how to "validate" the value typed in to make sure it is a valid selection.

>Hi James,

Thanks for your interest in Syncfusion product.

We glad to hear that your previous issue has been resolved. If you want to allow the user to type the valid test in the combobox then you have to set GridDropDownStyle to AutoComplete. Please refer to the following code snippet

Grid.ColStyles.Item(intCol).DropDownStyle=GridDropDownStyle.AutoComplete

I hope this will meet your requirement. Please let me know if you have any questions.

Thanks,
Nagaraj


JA James August 27, 2007 12:37 PM UTC

Ok. Autocomplete only allows for a valid selection. I trapped the Validate event, but the grid(grid.currentcell.rowindex,1).cellvalue always brings back nothing. Why is the value not passed? I have also attempted using the "Text" value with no luck.

>I have been able to set the dropdown to editable with autocomplete enabled. I would like to see if there is a "validation" event or somthing that is triggered when the user has typed a valid selection. Once the user has inputed a value that is in the list, I intend to populate other fields in the row with queries from SQL. So far, I have been able to trap for the Enter key press, but would like to know how to "validate" the value typed in to make sure it is a valid selection.

>Hi James,

Thanks for your interest in Syncfusion product.

We glad to hear that your previous issue has been resolved. If you want to allow the user to type the valid test in the combobox then you have to set GridDropDownStyle to AutoComplete. Please refer to the following code snippet

Grid.ColStyles.Item(intCol).DropDownStyle=GridDropDownStyle.AutoComplete

I hope this will meet your requirement. Please let me know if you have any questions.

Thanks,
Nagaraj


JA James August 27, 2007 07:08 PM UTC

>>>Bump<<<< I'm stuck here. Not able to get the value after CurrentCellValidated.


>Ok. Autocomplete only allows for a valid selection. I trapped the Validate event, but the grid(grid.currentcell.rowindex,1).cellvalue always brings back nothing. Why is the value not passed? I have also attempted using the "Text" value with no luck.

>I have been able to set the dropdown to editable with autocomplete enabled. I would like to see if there is a "validation" event or somthing that is triggered when the user has typed a valid selection. Once the user has inputed a value that is in the list, I intend to populate other fields in the row with queries from SQL. So far, I have been able to trap for the Enter key press, but would like to know how to "validate" the value typed in to make sure it is a valid selection.

>Hi James,

Thanks for your interest in Syncfusion product.

We glad to hear that your previous issue has been resolved. If you want to allow the user to type the valid test in the combobox then you have to set GridDropDownStyle to AutoComplete. Please refer to the following code snippet

Grid.ColStyles.Item(intCol).DropDownStyle=GridDropDownStyle.AutoComplete

I hope this will meet your requirement. Please let me know if you have any questions.

Thanks,
Nagaraj



J. J.Nagarajan Syncfusion Team August 28, 2007 12:43 AM UTC

Hi James,

When you set the DropDownStyle to AutoComplete, you will be able to type only the entries that are in the choice list (or) the user input is restricted to items from the ChoiceList or DataSource but the user can type text into the text box and the text box will be filled with a matching choice.

In such case, you can't able to enter any invalid entries. If you set the DropDownStyle to Editable, then you would be able to edit invalid entries also. You can handle the CurrentCellValidateString to validate each character that is pressed. this event gets triggered for each key stroke.

Also refer to the following kb article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340

Please let me know if you have any questions.

Regards,
Nagaraj


JA James August 28, 2007 11:41 AM UTC

Maybe I didn't clarify. I know all about below. The problem is when it is validated... ie... they hit the enter key with a valid text, I cannot retrieve the values. I have done Me.Grid(Me.Grid.CurrentCell.RowIndex, 1).CellValue and Me.Grid(Me.Grid.CurrentCell.RowIndex, 1).Text without luck. Why? As stated before, this is on Grid_CurrentCellValidated event.

>Hi James,

When you set the DropDownStyle to AutoComplete, you will be able to type only the entries that are in the choice list (or) the user input is restricted to items from the ChoiceList or DataSource but the user can type text into the text box and the text box will be filled with a matching choice.

In such case, you can't able to enter any invalid entries. If you set the DropDownStyle to Editable, then you would be able to edit invalid entries also. You can handle the CurrentCellValidateString to validate each character that is pressed. this event gets triggered for each key stroke.

Also refer to the following kb article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340

Please let me know if you have any questions.

Regards,
Nagaraj


J. J.Nagarajan Syncfusion Team August 29, 2007 02:40 AM UTC

Hi James,

To retrieve the value of the cell that is validated in the currectcellvalidated event use the CurrentCell.Renderer.ControlText property. Please refer to the following code snippet

this.gridControl1.CurrentCellValidated+=new EventHandler(gridControl1_CurrentCellValidated);

void gridControl1_CurrentCellValidated(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
Console.WriteLine(cc.Renderer.ControlText + " " + "CurrentCellValidated");
}

I have attached the sample that demonstrates this completely. You can download the samle from the following page.

http://websamples.syncfusion.com/samples/Grid.Windows/F67573/main.htm

Please refer to the sample and let me know if you have any questions.

Thanks,
Nagaraj

Loader.
Live Chat Icon For mobile
Up arrow icon