I am using ASP.NET Maker 2022.8.0I enabled “Multiple Delete” from asp.net > Page Options (Global).
After generating All pages (Tried delete all & fresh generate also) Can’t able to delete more than 2 rows.If I delete 2 rows it’s working fine.
If I delete 3+ rows it’s Not working. Page refreshing & Getting (Error - Delete Canceled)…F12 (Dev. tools) showing following event.RequestURL : domain/TableMasterDelete
RequestMethod : Post
Status Code : 302
futureaxs wrote:
F12 (Dev. tools) showing following…
If you use Chrome, check the Payload panel and check what data is posted.
I Just tested in one more project receving same error.
for 2 rows it’s working fine. more than 2 Error : Delete cancelled.Just did with fresh DB & having only 1 table with random data…Payload as follows…csrf_name:
__RequestVerificationToken
__RequestVerificationToken: (random token)action: deletekey_m: 4
key_m: 1
key_m: 3
key_m: 2
Upon some debugging in VS 2022 i find there was a delete query problem.query as follows
DELETE FROM [dbo].[table1] WHERE (([pkfield] = ‘1’) OR ([pkfield] = ‘2’) OR ([pkfield] = ‘7’) AND [pkfield]=N’1’) – Success
DELETE FROM [dbo].[table1] WHERE (([pkfield] = ‘1’) OR ([pkfield] = ‘2’) OR ([pkfield] = ‘7’) AND [pkfield]=N’2’) – Success
DELETE FROM [dbo].[table1] WHERE (([pkfield] = ‘1’) OR ([pkfield] = ‘2’) OR ([pkfield] = ‘7’) AND [pkfield]=N’7’) – Failed
when i run same in select query in SSMS like
select * FROM [dbo].[table1] WHERE (([pkfield] = ‘1’) OR ([pkfield] = ‘2’) OR ([pkfield] = ‘7’) AND [pkfield]=N’1’)
i get first 2 rows (1,2) only
So code will check each row separately and failing at 3rd row and cancles at complete Multiple delete query…
it seems to be filter problem…How do i overcome it…
New update — Temp Solved it by Adding some opening & closing ()'stable1.cs as follows
public async Task DeleteAsync(
string sql = “DELETE FROM " + UpdateTable + " WHERE (”;
(Old Code " WHERE" New Code " WHERE ("aspnetfn.cs as follows
public static void AddFilter(ref string filter, string? newfilter, string cond = “) AND”)
(Old Code “AND” New Code ") AND"But the real problem is AddFilter() is not only apply to Delete but all others…
Final update
aspnetfn.cs as follows
public static void AddFilter(ref string filter, string? newfilter, string cond = “) AND”)
(Old Code “AND” New Code “) AND”
added in table1.cs
if (!Empty(filter))
{
filter= filter.Replace(“AND”, “) AND”);
sql += filter;
}Seems to be working fine…Can this be update in template pls…
Please update to the latest template (Tools → Update Template) and try again.