Solved

manipulating datagrids

Posted on 2004-09-29
8
197 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
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.

734 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