Creating read-only forms in EWL

51 views Asked by At

I'm using Enterprise Web Library to create some elaborate web forms, which I've found to be very easy using the auto-generated form items and FormItemBlock. This is great for users who have authorization to mess with this data but my current issue is for users that don't. I want to share the page and the data shown with users in my application who have permission to view the data, not change it. Is there a way to easily switch some of the data to be read-only?

1

There are 1 answers

0
William Gross On

The Development Utility doesn't currently generate any form item getters that produce read-only controls, but you could use the generic getters. For example, this line of code would create a form item with a literal control:

GetMyFieldFormItem( true, ( value, label ) => value.GetLiteralControl(), value: currentValueFromDatabase );

I have plans to eventually implement:

  1. Individual read-only form items
  2. Read-only pages, where all form items are automatically read-only
  3. Read-only sites, where all form items on all pages are automatically read-only