Set Field as Read Only Based on User Level

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

Set Field as Read Only Based on User Level

Post by aspsteve »

First of all, I would like to apologize for the quality of the code below, as I am not a programmer.

However, I would like to make a field read only and set the value of the field to a default value based on User Level. If they are not in any of those two user levels (4 and 6), then they should be able to updated the field with a value

Please see my attempt at doing this which is throwing an error

I am using the Row Rendered Function

Code: Select all

// Row Rendered event
public void Row_Rendered() {
    //VarDump(<FieldName>); // View field properties
if CurrentUserLevel() == "6"?:
{
SelfServiceUserName.EditValue = "Not Authorized";
SelfServiceUserName.EditCustomAttributes = "readonly=\"readonly\"";
if CurrentUserLevel() == "4"?: 
{
SelfServiceUserName.EditValue = "Not Authorized";
SelfServiceUserName.EditCustomAttributes = "readonly=\"readonly\"";
Else 
	SelfServiceUserName.EditCustomAttributes = "not changed";
}
}

MichaelG
User
Posts: 854

Post by MichaelG »

It should be something like:

Code: Select all

if (...) {
Field.EditValue = "...";
Field.ReadOnly = true;
} else if (...) {
//...
} else {
//...
}

aspsteve
User
Posts: 65

Post by aspsteve »

Thank you very much. This worked


Post Reply