Error: No records found in master table view

Anybody knows why this would happen please? User has list, edit, and view permissions to master table. User can create a master record, but he can’t view it in “masterview/1?showdetail=”. The website show “Error: No records found” and redirects to masterlist. However, the user can list and edit without problem.

BTW when I give all available permissions to the user (who belongs to a user_level that I added myself after the Anonymous, Admin, and Default), the error still persists. Only the hard-coded admin gets no error and can see the master’s view.

The error makes no sense so I’ve been tweaking almost every setting int the master and detail tables, security settings… all in vain.

Oddly enough the error was because of enabling Detail Record Count on the master table. It could be a bug. I reproduced it on another project too.

  1. Create a project with a users table, a master table, and a details table
  2. Activate the USER ID security, assigning the “User ID Field” for the users and master table.
  3. Enable “Detail Record Count” on the master table.
  4. Click on the view icon to go to masterview/1?showdetail= and the error will pop up.

Thank you @regemailforsites2 for your great tip about disabling (Detail Record Count), I had a problem with a slightly different scenario but with the same error message (Error: No records found) which appeared randomly sometimes in a table that I am sure it contains that record; unfortunately, I couldn’t find any solution for it.

I tried now to disable the (Detail Record Count) option in that table as you’ve described and to my surprise, the error disappeared and the problem solved!

I thank you again for sharing the tip with us, and I agree with you that it may be a small bug that will be easy to solve after you’ve described the way it happened.

Also, I am very curious to know the way that you’ve followed to discover this solution while I couldn’t, especially since the error message that we see was not related to that option (Detail Record Count). Did you debug the code deeply step by step? Or was it just a coincidence?

Thank you.

You are welcome Amer. I’m new to ASPNETMaker so I haven’t dealt with the generated code yet. I’m still just testing its functionality to see if it’s suitable for any medium-level project. The way I found the problem was that I replicated the project’s database and created another project, started to configure it to make it exactly like the original project. Every time I was changing a configuration I tested the replica website, until I found the problem. So it was a trial-and-error approach. I love the RAD concept behind ASPNETMaker and how it’d save time, but my experience so far with ASPNETMaker has not been that great. I started discovering ASPNETMaker since almost a weeks ago, and so far I’ve discovered 2 security issues and this no-records-found-error problem. I thought these problems were because I’m new and didn’t know how to use ASPNETMaker, so I’ve spent a lot of time trying to solve them myself and then they turn out to be bugs. I hope it’s just a coincidence that I encountered these bugs in my first week because I do want to stay with ASPNETMaker because of its flexibility.

Did you have permissions to the detail tables as well if you have detail count enabled?

MichaelG wrote:

Did you have permissions to the detail tables as well if you have detail
count enabled?
Yes

Tested with the demo project with Orders/Order Details as the master/detail table and Detail Record count enabled for Orders. Cannot simulate. Please make sure that you are using the latest version (2020.0.8) and template (Tools → Update Template).

Uncheck the ASP.NET->Page Options (Global)->“Paging section in View page”, and you’ll see the error.

No, cannot simulate with Paging section in View page disabled. Please show your detailed Master/Detail settings.

In fact, to clear things up and not mislead you while trying to figure out the error: the option (Detail record count) was not the cause of my problem, I found that the real reason (in my case) was because of a saved search filter (after doing Advanced search) in that table, which for some reason is saved inside that table’ properties as a string property “SessionWhere” and remains preserved in it even after exiting it and working with other tables for a long time; the thing that affected viewing a record by its ID when opened from another page, something like:

localhost:5000/MyDataTableview/15

I have fixed it by setting (SearchWhere = “”:wink: for that table before trying to view any record from it; because if that record ID was not included within the saved filter, it will give that error message (Error: No records found) even though a record with that ID exists and a URL such as the one above should view it as long as it does not contains any search criteria.

sorry for my previous misleading comment, what happened as I think was that after changing (Detail record count) and rebuilding the project, the application startup cleanly and there was no such saved filter, so it worked perfectly with no errors, which cause me to think it was the reason.

If you have regenerated your application, it is in general a good idea to logout and login again to avoid unexpected behaviour of the application.

Amer wrote:

In fact, to clear things up and not mislead you while trying to figure out
the error: the option (Detail record count) was not the cause of my
problem, I found that the real reason (in my case) was because of a saved
search filter (after doing Advanced search) in that table, which for some
reason is saved inside that table’ properties as a string property
“SessionWhere” and remains preserved in it even after exiting it
and working with other tables for a long time; the thing that affected
viewing a record by its ID when opened from another page, something like:

localhost:5000/MyDataTableview/15

I have fixed it by setting (SearchWhere = “”:wink: for that table
before trying to view any record from it; because if that record ID was
not included within the saved filter, it will give that error message
(Error: No records found) even though a record with that ID exists and a
URL such as the one above should view it as long as it does not contains
any search criteria.

sorry for my previous misleading comment, what happened as I think was that
after changing (Detail record count) and rebuilding the project, the
application startup cleanly and there was no such saved filter, so it
worked perfectly with no errors, which cause me to think it was the reason.

I have the same problem, may I know which event you put the (SearchWhere = “”;)?

Try the Page_Load server event of the view page.

raymondfung wrote:

I have the same problem, may I know which event you put the (SearchWhere = “”;)?

Because I have many tables with the same situation and suffered from the same problem,
I found a general solution to my problem instead of writing the same code tens of times in most of my tables, which is to put the following in the event:

Server Events â–¶ Global â–¶ All Pages â–¶ Page_Loading:

// Page Loading event
public void Page_Loading()
{
// Enter your code here
// This is Global Page loading…

if(HttpContext.Request.Query[“resetfilter”].ToString() == “true”)
{
CurrentPage.SessionWhere = “”;
}
}

and whenever I want to view a record from any table from anywhere, all I need is to put this query (“resetfilter=true”) to the end of the URL, something like this:

localhost:5000/MyDataTableview/15?resetfilter=true

and the filter will be removed for me by the Page_Loading event, I’ve already used that in my big project and it is working good so far.

It works for me, many thanks.