Hi,
Im Using Ultrawebgrid v8.3
I have 2 columns, Column A is an editable column where the user enters data. Column B is a dropdownlist column where the data gets binded from the database based on the data entered in Column A.
For example, If the User enters 'R' in Column A and hits the tab button, the grid calls the UpdateCell event and binds the data 'Red,Rose'.This is for Row1.
In Row2, If the User enters 'G' in Column A and hits the tab button, the grid calls the UpdateCell event and binds the data 'Green,Gray'.
The problem is, the data binded to dropdownlist in Row2 is getting binded to all the dropdownlist of each row in the grid.
How to bind row specific dropdownlist data in ultrawebgrid?
Yes, you are correct. selectWhere() filters values from bound data only.
I think you can use combination of both the method in following way.
Handle BeforeEnterEditMode event which fires AJAX call and fetch data based on value of first column value. In this case can make web combo non-editable by setting Editable="false".
About UpdateCell:
Have you tried setting LoadOnDemand = “XML”?
Thanks for ur thoughts, but tell me if im wrong, that combo.selectWhere statement will just filters the records in webcombo and it will not query the database. Is that correct?
If it is correct, then i do not want to handle it in clientside, bcoz the data for the dropdownlist may be from the database or it can be dynamic. So i need to handle it in Serverside.
The 2nd one (using Ajax EditKeyUp event), doesn't meet my requirement. I donot want the user to edit the combo. just populate the combo based on the data entered in previous column is enough.
FYI, i tried using ASP.NET dropdownlist in the templated column. So everytime the row gets bounded, i manually find the dropdownlist and bind the data. This works.
But the problem is, the UpdateCell event (Serverside) is not firing when an item is chosen in the dropdownlist and a tab key is pressed.
The updatecell event has to be fired, coz based on the selected item, i need to show related data in the next cell.
Let me know ur thoughts on these...
Hello,
I think there is no way to set different dropdownlist to different rows. The reason is when we set an editor control for the column, it applies to all the rows for that column. Does this make sense?
But still your issue could be resolved by following way.
You need to bind the data to dropdown when it is requested. It means you should delay binding the drop down list until user enters in edit mode of drop down cell.
In that case you can apply filter based on user entry of first column.
You can use following steps to achieve this functionality
(1) This method can be used with web combo. Replace you drop down list with web combo if you are not using it now.
(2) Handle Client side BeforeEnterEditMode event of drop down list.
(3) Inside the event handler use selectWhere() method in this way to get data based on col1 value
var colAVAlue=row.getCell(0).getValue();
combo.selectWhere("ColA='"+ colAVAlue +"'");
I think you can use like operator in above step.
A similar example is also available in IG samples. Check it using following link.
Sample (using BeforeEnterEditMode event)
Also refer this link for another way to achieve the same: Sample 2 (Using Ajax on EditKeyUp event)
Please let me know if this help you or you need further detail.
Greetings