North American Sales: 1-800-231-8588
Global Contacts
My Account
Menu
North American Sales: 1-800-321-8588
My Account
Sign In/Register
Design & Development
Design & Develop
Best Value
Infragistics Ultimate
The complete toolkit for building high performing web, mobile and desktop apps.
Indigo.Design
Use a unified platform for visual design, UX prototyping, code generation and application development.
Web
Ignite UI for Angular
Ignite UI for JavaScript
Ignite UI for React
Ultimate UI for ASP.NET
Indigo.Design
Desktop
Ultimate UI for Windows Forms
Ultimate UI for WPF
Prototyping
Indigo.Design
Mobile
Ultimate UI for Xamarin
Ultimate UI for iOS
Ultimate UI for Android
Automated Testing Tools
Test Automation for Micro Focus UFT: Windows Forms
Test Automation for Micro Focus UFT: WPF
Test Automation for IBM RFT: Windows Forms
UX
Indigo.Design Desktop
Collaborative prototyping and remote usability testing for UX & usability professionals
Indigo.Design
A Unified Platform for Visual Design, UX Prototyping, Code Generation, and App Development
Business Intelligence
Reveal Embedded
Accelerate your time to market with powerful, beautiful dashboards into your apps
Reveal App
Empower everyone in your organization to use data to make smarter business decisions
Team Productivity
Learn & Support
Support
Help & Support Documents
Blogs
Forums
Product Ideas
Reference Applications
Customer Stories
Webinars
eBook & Whitepapers
Events
Free Trials
Pricing
Product Pricing / Buy Online
Renew Existing License
Contact Us
Forums
Retired Products and Controls
Your Privacy Matters
: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use.
Cookie Policy
Close
State
Not Answered
Replies
3 replies
Subscribers
4 subscribers
Views
598941 views
Users
0 members are here
UltraWebGrid (Retired)
ASP.NET
Share
More
Cancel
265
Issue deleting a row in webgrid
k
posted
over 15 years ago
I have a WebGrid where I am adding rows.
Now there is a delete button on the page which deletes the selected row from the grid.
My problem is when say my grid has 2 rows and they sort the grid and then select the second row and press delete. It deletes the first row and when I now select my first row and now press delete it keeps on popping up my confirm window a couple of times and then delete the row. Where am i going wrong. here is my code.
function DeleteDataFromGrid()
{
var gridClientId = '<%=grid.ClientID %>';
var grid = igtbl_getGridById(gridClientId);
igtbl_getGridById(gridClientId).AllowDelete=1;
var activeRow = igtbl_getActiveRow(gridClientId);
var rowId, row;
if(grid.Rows.length >0)
{
if(igtbl_getLength(grid.SelectedRows)>0)
{
for(rowId in grid.SelectedRows)
{
if (confirm('Are you sure you would like to delete this item?'))
{
igtbl_deleteRow(gridClientId,rowId);
}
}
}
else
{
alert("Please select an item to delete.");
}
}
else
{
alert("No item to delete.");
}
}
Parents
265
k
posted
over 15 years ago
Please suggest
Cancel
Reply
Verify Answer
Cancel
Reply
265
k
posted
over 15 years ago
in reply to
k
anyone?
Cancel
Reply
Verify Answer
Cancel
Children
14049
Offline
Alex Kartavov
posted
over 15 years ago
in reply to
k
It's better if you use igtbl_deleteSelRows(gridClientId), cause there is
a lot of stuff under the hood that needs to be taken care of when
deleting all of the selected rows. This method will do it all for you.
Cancel
Reply
Verify Answer
Cancel