Solved

manipulating datagrids

Posted on 2004-09-29
8
189 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
Comment Utility
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
Comment Utility
i tried this  but it still allows adding to the datagrid
0
 
LVL 22

Expert Comment

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

0
 
LVL 22

Expert Comment

by:Snarf0001
Comment Utility
Are you using any different DataGridTableStyles, or binding with .SetDataBinding instead of .DataSource?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 7

Expert Comment

by:J_Mak
Comment Utility
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
Comment Utility
You would need to have the dataview set as the datasource to do this.
0
 
LVL 22

Expert Comment

by:Snarf0001
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now