Solved

How do you make records Read-only in mvc 4

Posted on 2014-04-18
4
277 Views
Last Modified: 2014-04-23
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
Comment
Question by:vcurtis
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40010184
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
 

Author Comment

by:vcurtis
ID: 40012990
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
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 40013144
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
 

Author Closing Comment

by:vcurtis
ID: 40018933
Thanks Carl
  That worked
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now