Hi, I have a webdatagrid (Product, Color_type) the products is text field, and the Color_type is Dropdown Provider cell.
my DB is is like:
Red
so what I need is when I load my webdatagrid, it will load the drop down with only available Color_type for the products
the results should be
(DropDwon)RedYellowOrange
(DropDown)128GB256GB
is it possible?
Hello,
This could be achieved by using the dropdown opening client-side event and using the loadItems method of the dropdown provider there. In the dropdown opening event the value of the Product column should be obtained and provided as an argument of the loadItems method. Then on server-side the ItemRequested event should be used to set the data source for the dropdown provider based on the value of the Product column.
I have prepared a small sample to demonstrate this approach, which I am attaching below.
Please test the sample on your side and let me know if you have any questions or concerns.
Regards, Ivan Kitanov
DDBasonOnAnotherColumn.zip
Hi Ivan, I'm really sorry that I forgot to mentioned that I'm using Vb.net, please accept my apologies. I tried to follow your example and to code it into vb.net code, all good except below line, I didn't manage to write it in vb.net code, would you please help.
this.DropDownProvider1.EditorControl.ItemsRequested += EditorControl_ItemsRequested;
and I have another question, is it possible to assign a DropdownProvider to specific row and cell? for example, I have DropDownProvider_1 and DropDownProvider_2, I want to assign the DropDownProvider_1 to rows(1).item("Editor") and DropDownProvider_2 to rows(2).item("Editor") , both cells are in the same column, is it possible for each cell (cells are under one column) in each row to have different DropDownProvider ? can this be achieved in Code Behind?
Hi,
The line you were unable to convert is for assigning event handler for the Items Requested event. So, you can either use AddHandler or Handles at the end of the event handler.
The code for it should be the following:
AddHandler DropDownProvider1.EditorControl.ItemsRequested, AddressOf EditorControl_ItemsRequested Or Private Sub EditorControl_ItemsRequested(ByVal sender As Object, ByVal e As Infragistics.Web.UI.ListControls.DropDownItemsRequestedEventArgs) Handles DropDownProvider1.EditorControl.ItemsRequested
Regarding your other question, if two or more editors could be set based on the cell, this is not possible since the editors are assigned to the column and not to the cells, however if you would like to assign data source based on the row index instead of the value of another cell, you can provide the row index with the loadItems method on the client and then use it to change the DataSource property inside the ItemsRequested event.
Please let me know if you have any questions or concerns.