Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

How do you make records Read-only in mvc 4

Please help
       I want to be able to click on a button(s) and deactivate a row(s).
                1) click on a button(S)
                2) press the deactivate * * button
                3) the record is now read only and the text of the record is grayed out
                 4) the fact that this record is readonly has to be stored in the sql database for future inquires
ReadOnly.rtf
0
vcurtis
Asked:
vcurtis
  • 2
  • 2
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
Which part do you need help with exactly? Presumably you are already reading/writing data to your database.

There is no built-in way in the database to mark a record read only, so you need to do it yourself. A simple bit field should do the job.
0
 
vcurtisAuthor Commented:
You are right about the database, So I using the "bit" datatype. What I am not sure is, how can I do the following
  1) have the application Read the bit datatype as false/true
  2) have the  application "grey out" the record so it is read-only and cannot be clicked or
0
 
Carl TawnSystems and Integration DeveloperCommented:
It depends how you are reading your data. If you are using a DataReader then calling GetBoolean with the index of your column will convert the bit to a bool.

Once you check that value you can simply set the Enabled property of your server controls to false to disable/grey them out.
0
 
vcurtisAuthor Commented:
Thanks Carl
  That worked
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now