Page 1 of 1

Hide add button on single record

Posted: Tue Apr 19, 2022 4:39 am
by crash

I am converting my old aspmaker to aspmaker dot net

Previously I was able to hide the add button if already had a single record. I am now not sure how to load this code.
Can anyone help with this code please. Current code is not working. Thanks

// Page Load event
public void Page_Render() {

If Page.TotalRecs = "1" Then
Set item = AddEditOptions.GetItem("add")
item.Visible = False

}


Re: Hide add button on single record

Posted: Tue Apr 19, 2022 6:57 am
by MichaelG

You should learn the C# syntax and convert your classic ASP codes accordingly.


Re: Hide add button on single record

Posted: Mon May 02, 2022 5:09 am
by crash

I've tried another option now. Why would this not be working. I'm still getting to know C#

I need to hide the add button

// Page Load event
public void Page_Render() {
//Log("Page Render");

if (CurrentUserName() == "xxx" && CurrentTable.Name == "xxxRegisterlist")
ListOptions ["add"] .Visible = false;


}


Re: Hide add button on single record

Posted: Mon May 02, 2022 7:44 am
by MichaelG

You can easily debug your codes by opening the project in Visual Studio 2022 and adding a break point to your server event codes.