Friends,

I have a master-detail form.
How can I set permission for the form in such a way that,
a user having permission to edit only can edit a record.
a user having permission to view can only view the data and print it.

Can you suggest some methods or resources?

Thanks in advance.

You should know the permissions for the current user when the page loads.

Now, the easiest thing to do to make the page read-only is to hide the "Save" button or whichever button causes the data to be saved.

if (!canEdit)
    btnSave.Visible = false;

Another way is to disable all your editable and clickable controls such as textboxes, checkboxes, dropdowns, buttons, etc.

Alternatively, you can render a whole separate part of the page that has no editable controls (that is, show a label instead of every textbox, checkbox, dropdown, etc.). Also, you can simply redirect the user to another page that presents the data in a read-only, printer-friendly way.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.