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
Solved

manipulating datagrids

Posted on 2004-09-29
8
195 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
8 Comments
 
LVL 22

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 22

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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 22

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 22

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net - Project Software to help the Developer 7 40
Creating a route in asp.net webforms 2 32
.NET 2008 VB and C# 6 39
VB.NET 2008 Winforms Signing 13 31
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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