Hide a field

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
crash
User
Posts: 151

Hide a field

Post by crash »

I'm trying to hide a field on a list page
Using the help guide

My field is called <level>... but it's not hiding.. code is below.. can anyone help

public void Page_DataRendering() {
level.Visible = false; // Hide a field named "MyField"
}

Thanks


MichaelG
User
Posts: 1111

Post by MichaelG »

Try the Page_Load or Page_Render server events.


crash
User
Posts: 151

Post by crash »

Thanks, I got that to work under Page_Render but now how do I make this work on an if statement.

I'm trying to hide a field if the current user level is 4... I've tried many options including the options in the guide which only refers to username... and even that won't work.
This is my code... Thanks

public void Page_Render () { if (CurrentUserLevel() == "4") Level.Visible = false;
}


MichaelG
User
Posts: 1111

Post by MichaelG »

You can add more debugging codes to test. For example (make sure that Tools -> Advanced Settings -> Debug / Log to file are enabled):

Log("current user level: " + CurrentUserLevel());
if (CurrentUserLevel() == "4") {
Level.Visible = false;
Log("set visible to false");
} else {
Log("visible not changed");
}

Check the log file for the debugging messages.


Post Reply