Hi.
I have an Ultrawebgrid with a dropdown in one of the columns. What I need to do is filter the contents of the dropdown differently for each row based on a value in one of the other columns in that row. The datasource for the dropdown remains the same, but the filter needs to change.
Is this possible?
Thanks in advance.
I think this sample is closest to what you need. Just click the"Fill Order" button and you will see three comboboxes, each one dependant on the previous selection.
Thank you for the response.
I tried to implement a variation on that example using the value in a column of my datagrid, but I wasn't able to get it to work. My WebCombo is populated with data from a datatable. The error message first indicated that I needed to implement the InitializeDataSource event, but I kept getting errors when trying to use this event. There didn't seem to be an option in the WebCombo for 'OnInitializeDataSource'.
Any additional information would be appreciated.
Hello,
Looking at the source code for the sample, I do not see InitializeDataSource used there for combobox - did you start from the source code posted there (in the code tabs above the example). Also, if I am not mistaken, InitializeDataSource at one point was removed from grid and then re-added again - could this be a version thing? Which version are you using?
Hi. Thank you again for your response.
I'm using version 8.1. InitializeDataSource on the Grid works fine, but not on the WebCombo. The sample is using an AccessDataSource where I'm trying to assign the Datasource using a datatable in the code behind. I'm guessing that you don't need an InitializeDataSource when you have a DataSourceID set. I have the javascript working up until the selectWhere function, but since I can't set EnableXmlHTTP="True" without an InitializeDataSource, and since InitializeDataSource doesn't seem to be an option with my WebCombo, I can't get the dropdown filter to work.
I would appreciate any more suggestions.
Okay. I figured it out (with help).
Apparently, it had nothing to do with the 'selectWhere' function. The problem was in the function: igcmbo_getComboById. When I simply put in the ID of my webcombo, it was coming back with Null. I had to put in:
'<%=WebCombo1.ClientID %>'
as the argument to the function. Now it's properly filtering the webcombo.
Thanks again for your assistance.
I wired up the InitializeDataSource and it seems to be working, however, it seems that the selectWhere function will only work with certain datasources:
"The method will work only with DataSources that support SQL statements (SqlDbAdapter, SqlDataSourceControl for CLR2 etc.). "
Is there a way to make an AJAX call to filter a datatable if that is the datasource of the WebCombo?
Thanks.
Yes, at one point we were uncertain about InitializeDataSource and even though we kept it for backwards compatibility it was not availble in the property grid events page. Then we got it back. In any way, it is still working you just need to hook it with code in the OnInit event of the page
Example:
protected override void OnInit(EventArgs e) { base.OnInit(e); WebCombo1.InitializeDataSource += new Infragistics.WebUI.WebCombo.InitializeDataSourceEventHandler(WebCombo1_InitializeDataSource); } void WebCombo1_InitializeDataSource(object sender, Infragistics.WebUI.WebCombo.WebComboEventArgs e) { // bind here }