Solved

Configure a DataGrid for limited user access

Posted on 2007-04-04
2
245 Views
Last Modified: 2010-04-23
Hi,

I have a datagrid that is bound to a datatable in code and I am using DataGridTableStyles to format the grid just the way I want it to look. I don't want the user to be able to add any new rows so I set the dagatgrid.ReadOnly property to TRUE. However, there is one column of rows that I do want the user to be able to change. In this case I was thinking the user could type a new number in a particular cell and then click on a button to store the changes back to the original database table.

So, is there any way to prevent the user from adding rows to a datagrid and keep the entire datagrid as Read-)nly except for one column?

Thanks,
Charlie
0
Comment
Question by:charlieb01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 5

Accepted Solution

by:
mytonytiger earned 500 total points
ID: 18853959
I assume you are using VS 2003:

To prevent the users from adding rows, you have to set it in the datatable being used as a datasource.
An example is:  

Dim ds as new dataset
'---------------------
'Fill dataset here
'---------------------

'Now turn off the new row
ds.tables(0).DefaultView.AllowNew = False
datagrid1.datasource = ds.tables(0)

0
 
LVL 5

Expert Comment

by:mytonytiger
ID: 18853969
The Second part of your question is about locking down all but one column:

You can set each individual column of the datatable as readonly.

ds.tables(0).Columns(0).readonly = True
ds.tables(0).Columns(1).readonly = True
ds.tables(0).Columns(2).readonly = True
'etc....
ds.tables(0).Columns(3).readonly = false ' This one is editable.



Hope that helps
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 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