I am using Infragistics Ultrawebgrid.
When the user press the delete key on a particular row on the grid, that particular row needs to be deleted. This is working fine.
I used DropDownList with an UltrawebGrid and binding the values using a stored procedure. The DropDownList contains list of items ( e. g. Item1, Item2, Item4, Item5, Item6...).
DropDownList
UltrawebGrid
Item1, Item2, Item4, Item5, Item6...
I used after cell updation ( Client side event in ultrawebgrid) to avoid to choose the same item. When the user chooses the same item it says 'this item already exist'.
ultrawebgrid
When the user chooses an item , the price and weight of the item will appear in that row.
It may be a situation that - after choosing items (say for example item1, item2, item3 ) - the user may delete any one of the selected items ( say for example item1).
item1, item2, item3
item1
So when user press delete on item1 , the item will be deleted.
My problem is after deletion of the item (item1) in Ultrawebgird, if I choose another row (item4) it says 'This item already Exist (but, in that grid there is no such item). .
Ultrawebgird
item4
What do I need to do?
I am using
Hello karthikeyan ,
Thank you for posting in our forum.
I have some additional questions regarding the exact scenario:
Is the DropDownList nested inside the cell?
Could you share the logic in the cell updating event that checks whether the item is already selected?
Which version of our control are you currently using?
I’m looking forward to your reply.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://ko.infragistics.com/support
Hi Maya,
Thanks for your reply, Please find my response below
Ans : I have bound the dropdownlist to the cell at serverside code (column type to dropdownlist)
2. Could you share the logic in the cell updating event that checks whether the item is already selected?
function uw_Exp_AfterCellUpdateHandler(gridName, cellId) { var cell = igtbl_getCellById(cellId); var colkey = cell.Column.Key; var curRowIndex = cell.getRow().getIndex(); var rows = igtbl_getGridById(gridName).Rows; var curLine = rows.getRow(curRowIndex); var curGridName = "<%=uw_Exp.ClientID%>"; var curCellId = cellId.substring(cellId.lastIndexOf("_") + 1); var grd = igtbl_getGridById(curGridName); var actRow = igtbl_getActiveRow(curGridName); var rowIndex = actRow.Element.id; var curRowId = rowIndex.substring(rowIndex.lastIndexOf("_") + 1); var grdRws = grd.Rows; var rws = grdRws.length; actRow.getCell(0).setValue(eval(curRowId) + 1); if (colkey == "Item_Name") { if (actRow.getCellFromKey('Item_Name').getValue() != null) { for (i = 0; i <= rws - 1; i++) { if ((curRowId != i) && (actRow.getCellFromKey('Item_Name').getValue() == grdRws.getRow(i).getCellFromKey('Item_Name').getValue())) { alert('This Item already exists'); } } } } }
3. Which version of our control are you currently using?
11.1
Hi,
I'm just checking if you still need assistance with the matter.
PFA
Hello,
I see there is always 1 row in the grid. What happens after you try to delete the row? Are you saving the changes to the database? Did you try to rebind the grid? It seems like there is another row with the same value in the Item_Name column. Are you sure that this column has unique values?
We use the grid here to enter the purchase details of items where we should not allow the same item again to be selected in the grid. For that, we have validated in the aftercellupdatehandler, to alert when the user selects the already existing item in the grid. This works good as coded (If we select any existing item it alerts as exists else accepts the entry in the grid) until we delete a row from the grid by pressing the delete key. Once we delete any row from the grid, then it alerts for any item (even if it is not exists in the grid) that is selected from the dropdown column of grid.
I don't understand what is exactly your scenario. How are you checking if the selected item from the dropdown exists in the grid? What is the connection between the dropdown items and grid records? What is the grid datasource?
I'm glad you have managed to resolve your issue.
Let me know if you have any other questions or concerns.
The Problem Is in AfterCellUpdationEvent. So We find and solved the problem. Thanks For Your Team to interest Regarding This Issue.
I am still unable to reproduce the issue you have described. Is it possible for you to provide me with a small running sample that I can test and debug on my side?
Thank you.
We are using ultrawebgrid.
1. The Values Will Bind Into Ultrawebgrid in Server Side(Using Stored Procedure) On Page Load.
2. There Are 6 Column in The Ultawebgrid.(sno,item,price,qty...etc)
3. The Column Type of item is DropDownList.
4. We are Bind the Values separately For Ultrawebgrid and DropDownList. And the stored Procedure Also Different.
5. It is must that the item(That is Binded in DropDownlist Of ultrawebgrid) can't be selected more than once.(That is assume that the item column have records like item1,item2,item3,item4 then if item1 selected in first row of ultrawebgrid it will not be allowed to select again).
6. We Prevent That by using afterCellUpdation by prompting 'This item already Exist'.And this works fine.
Our Problem is after delete one row( Say for example we load item1,item2,item3. And we delete a row item 1 by pressing deletekey in the keyboard)
if we load another item(item4,item6) That also prompt 'This item already Exist'. Kindly understand and solve our problem.