Prevent Display of a Control Based on an ID Value

Tips submitted by ASPMaker users

Prevent Display of a Control Based on an ID Value

Postby xgis » Sat Mar 23, 2013 9:58 am

In some cases you do not want the user to be able to change an existing selection.
The purpose in this case is to prevent users from modifying critical parent elements in a table for a user managed dynamic website.
This example demonstrates how you can turn off a control based on an ID or a NULL value. It uses the Row Rendered event.

This is the first way which works on fixed top level menus. eg Home, Products Services, Contact. These are the first 4 entries in a table with ID's 1-4.

' Row Rendered event
Sub Row_Rendered()
If ContentID.CurrentValue < 5 Then 'This filters fixed NULL ParentID values for the Hierarchical Top Level Menu on a Website
ContentParentID.Visible = True 'If value is greater than 4 then make the Control Visible so the User can Select a Parent Page
End If
End Sub

The Better Way because it allows users to create new Top Level Menus with ParentID = NULL;

' Row Rendered event
Sub Row_Rendered()
if IsNull (ContentParentID.CurrentValue) Then 'These are fixed NULL ParentID values for the Hierarchical Top Level Menu on a Website
ContentParentID.Visible = False 'If the Parent value is NULL then hide the Control
End If
End Sub
xgis
 
Posts: 87
Joined: Thu Jan 17, 2013 10:40 pm

Return to User Submitted Tips (ASPMaker)



cron