Solved

manipulating datagrids

Posted on 2004-09-29
8
198 Views
Last Modified: 2010-04-23
Hello I am trying to make my datagrid 10 rows and not allow insert for new rows
they can edit anything in the first 10 rows but that is it.
I have been trying to find the properties but cant find it

I have everything else working the way I want

it is form based not aspx based

thanks
0
Comment
Question by:genesisproject
[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
8 Comments
 
LVL 23

Accepted Solution

by:
Snarf0001 earned 500 total points
ID: 12182673
Dataviews have a property called AllowNew, which will disable the adding feature at the bottom of the grid, and all datatables/datasets have a default view associated with them.

ie with myDataTable and myDataGrid

myDataTable.DefaultView.AllowNew = False
myDataGrid.DataSource = myDataTable

This will not allow new rows to be entered.
0
 

Author Comment

by:genesisproject
ID: 12183824
i tried this  but it still allows adding to the datagrid
0
 
LVL 23

Expert Comment

by:Snarf0001
ID: 12183852
That's odd, if you're binding like that it shouldn't.
Can you post the code where you bind to the grid?

0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 23

Expert Comment

by:Snarf0001
ID: 12183867
Are you using any different DataGridTableStyles, or binding with .SetDataBinding instead of .DataSource?
0
 
LVL 7

Expert Comment

by:J_Mak
ID: 12186949
I don't know if this link would help:

http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp

Have a look if it has your answer. Cheers!
0
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12190639
You would need to have the dataview set as the datasource to do this.
0
 
LVL 23

Expert Comment

by:Snarf0001
ID: 12190726
Robert, it has been my experience, that a grid will always bind to a view, if not explicitly specified, then to the .DefaultView of the datasource.
At least when using a datatable, I don't often use datasets.

If you set the rowfilter of the defaultview to limit to say 10 rows, and the bind on the table, not the defautview, the grid will still populate only 10 rows.

Please elaborate if you've had different experiences.
0
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12190887
Yes, that does work, but only when you bind directly to the table.  i.e. datasource = dataset.table

If you use the common, datasource = dataset, datamember = "table" then this does not work.
(I think it still creates a dataview, but it isn't the table's default)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

617 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