I use a RadAutoCompleteBox with DataScouceID set inside an InsertItemTemplate of a RadGrid. When clicking on add-record button i got a 'DataSource not set' exception. I have to use the OnDataSourceSelect function to manually control the amount of data. It seems that the databounding has to be earlier. I tried to set the DataSource in the ItemCreate event on the RadGrid, and do not use the DataScouceID property. But in this case, I got an ReadOnlyDataSource in the OnDataSourceSelect event passed and the solution provided below does not work any more.
Could you please tell me what to do in order to keep the function txtSciMapUser_DataSourceSelect as it is?
Thanks a lot.
protected void txtSciMapUser_DataSourceSelect(object sender, AutoCompleteBoxDataSourceSelectEventArgs e){ SqlDataSource source = (SqlDataSource)e.DataSource; RadAutoCompleteBox autoCompleteBox = (RadAutoCompleteBox)sender; string filterString = e.FilterString; string likeCondition = string.Format("'{0}{1}%'", autoCompleteBox.Filter == RadAutoCompleteFilter.Contains ? "%" : "", filterString); source.SelectCommand = "SELECT TOP 100 * FROM sm_user WHERE [" + autoCompleteBox.DataTextField + "] LIKE " + likeCondition;}