Dynamic data binding for autocomplete

Hi

I have a autocomplete drop down in a grouping grid. As soon as the user starts typing in - i need to make a call to fetch the data and bind the same to the control.
I am using the grid_TableControlCurrentCellChanged event to get the typed in data and then making a call. That works fine and i do get my data set.
But the probelm is - the data set doesn't get bound to the dropdown.
What i could make out was, for dynamic data binding the Grid_QueryCellStyleInfo event needs to be handled and the dataset be bound to the control again - Is that correct.
Also, i dont want to cache the dataset and make a call as soon as the user types in - because of which if i add code in the Grid_QueryCellStyleInfo event, i would have to make another call.

Do you have a better way of doing this?

I would really appreciate a quick response.

Thanks
-Namita


5 Replies

NJ Namita Jain June 28, 2011 06:33 PM UTC

I am using the GridListControl (the autocomplete) in the Grouping grid



NJ Namita Jain June 30, 2011 02:34 PM UTC

Can i get to hear anything on this issue please?



RB Ragamathulla B Syncfusion Team July 6, 2011 07:17 AM UTC

Hi Namita,

We regret for the delay in getting back to you.

You can set ‘AutoComplete’ to the combo box cell style’s ‘DropDownStyle’ property to apply the auto complete functionality. In the given sample, I have established combo box cell with cell type ‘GridListControl’ along with the following code.


// In Form1_Load

this.gridGroupingControl1.TableDescriptor.Columns["Custom"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;
this.gridGroupingControl1.TableDescriptor.Columns["Custom"].Appearance.AnyRecordFieldCell.DataSource = GetTheGridTable();
this.gridGroupingControl1.TableDescriptor.Columns["Custom"].Appearance.AnyRecordFieldCell.DisplayMember = "OrderID";
this.gridGroupingControl1.TableDescriptor.Columns["Custom"].Appearance.AnyRecordFieldCell.ValueMember = "OrderID";
this.gridGroupingControl1.TableDescriptor.Columns["Custom"].Appearance.AnyRecordFieldCell.DropDownStyle = GridDropDownStyle.AutoComplete;



Please refer to the following sample which illustrates the same.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGCListControl-723279129.zip>

Let me know if this helps.

Regards,
Ragamathullah B.




NJ Namita Jain July 13, 2011 07:29 PM UTC

I don't want to set the same datasource for all the cells in a given column. Each cell can have a different datasource - which is NOT populated on form load and would be populated at run time when the user starts typing(and would be the output of a web service).
I am able to bind different data sources to different cells. the only problem is - as soon as any item from the drop down is clicked, the datasource(for that particular drop down) gets lost.

Is there a way(any event??) i can persist the datasource?I hope you got what I want to convey.

Please advise if you can help on this?



RB Ragamathulla B Syncfusion Team July 14, 2011 01:37 PM UTC

Hi Namita,

Thanks for your interest in Syncfusion products.

You can bind different data source for each comboboxcell using ‘QueryCellStyleInfo’ event. The following code explain the same.


this.gridGroupingControl1.TableDescriptor.QueryCellStyleInfo += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventHandler(TableDescriptor_QueryCellStyleInfo);

void TableDescriptor_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.ColIndex == 4)
if (e.TableCellIdentity.RowIndex == 6)
e.Style.DataSource = GetTheGridTable2();
else if(e.TableCellIdentity.RowIndex == 7)
e.Style.DataSource = GetTheGridTable1();
}


Please refer to the following sample which illustrates the same.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGCListControlDifferentDatasourceEachRow-624412195.zip

Let me know if you have any concern.

Regards,
Ragamathullah B.



Loader.
Up arrow icon