Solved

How do you make records Read-only in mvc 4

Posted on 2014-04-18
4
274 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 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

13 Experts available now in Live!

Get 1:1 Help Now