troubleshooting Question

How do I make a single cell in a DataTable ReadOnly?

Avatar of dcl120748
dcl120748Flag for United Kingdom of Great Britain and Northern Ireland asked on
C#ASP.NET
4 Comments1 Solution519 ViewsLast Modified:
I am creating a DataTable from a DataReader and conditionally I can make a column ReadOnly as below. However how can I make just a cell in that row ReadOnly rather than the whole column?

 while (rdr.Read())
 {
         DataRow dr = dt.NewRow();
         if (rdr.GetDateTime(8).ToString().Equals("01/01/1900 00:00:00"))
                        {
                            dr[8] = false;
                        }
                        else
                        {
                            dr[8] = true;
                            dt.Columns[8].ReadOnly = true;
                        }
          dt.Rows.Add(dr);
}

Thanks,
Dee
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros