Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

manipulating datagrids

Posted on 2004-09-29
8
Medium Priority
?
199 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 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 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