473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Disable Adding New Records in a DataGrid Control

Using VB.NET: I am populating a DataTable from a SQL Server table, then
associating that DataTable to a DataGrid control. I want to disallow the
user from inserting new records on that DataGrid, but I cannot find a way to
do this. Is there a way to prevent a user from inserting a new row through
the DataGrid - either
in the DataGrid itself, or in the original DataTable I am creating?

- Thanks,

JRD

Jul 21 '05 #1
2 2041
John,

Your only possibility in that is
dataview(defaultview).allownew = false

(When you than want to add a row in code using the dataview you have to set
it temporaly to true)

Although the code in C# is exactly the same. Did you know that there is a
newsgroup
microsoft.public.dotnet.languages.vb
and as well
microsoft.public.framework.adonet

However I hope that the answer on your qeustion helps?

Cor
"John R. Dougherty"
Using VB.NET: I am populating a DataTable from a SQL Server table, then
associating that DataTable to a DataGrid control. I want to disallow the
user from inserting new records on that DataGrid, but I cannot find a way to do this. Is there a way to prevent a user from inserting a new row through the DataGrid - either
in the DataGrid itself, or in the original DataTable I am creating?

- Thanks,

JRD

Jul 21 '05 #2
What about if you wanted to have the new rows show up on the top of the
datagrid instead of the bottom?

"Cor Ligthert" wrote:
John,

Your only possibility in that is
dataview(defaultview).allownew = false

(When you than want to add a row in code using the dataview you have to set
it temporaly to true)

Although the code in C# is exactly the same. Did you know that there is a
newsgroup
microsoft.public.dotnet.languages.vb
and as well
microsoft.public.framework.adonet

However I hope that the answer on your qeustion helps?

Cor
"John R. Dougherty"
Using VB.NET: I am populating a DataTable from a SQL Server table, then
associating that DataTable to a DataGrid control. I want to disallow the
user from inserting new records on that DataGrid, but I cannot find a way

to
do this. Is there a way to prevent a user from inserting a new row

through
the DataGrid - either
in the DataGrid itself, or in the original DataTable I am creating?

- Thanks,

JRD


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sue | last post by:
On code-behind page: (attributes set programatically for each of these elements) linkbutton added to tablecell textbox added to tablecell tablecells added to tablerow tablerow added to table...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
1
by: Chip | last post by:
I'm using Andy Smith's RowSelectorColumn control (great control) and I'm not sure if this question is generic to all datagrid controls or this particular one. Is there a way to disable one of...
3
by: suresh | last post by:
frenz, i need to disable the add new record mode in datarid. i just want to modify the existing records in the grid...but i dont want to add new records..how do i do that? -suresh
2
by: Tor Inge Rislaa | last post by:
Prevent Adding new records in DataGrid Hi I have a DataGrid that I want to open for editing but the user should not be able to add new records. When I set the ReadOnly = False it is possible...
2
by: John R. Dougherty | last post by:
Using VB.NET: I am populating a DataTable from a SQL Server table, then associating that DataTable to a DataGrid control. I want to disallow the user from inserting new records on that DataGrid,...
8
by: simchajoy2000 | last post by:
I thought the only thing I had to do to disable column sorting in VB.NET was to set datagrid.AllowSorting = False. Unfortunately this has never worked for me. I discovered another set of code...
15
by: glenn | last post by:
Hi folks, I have a DropDownList in a DataGrid that is populated from records in a database. I want to add a value that might be a string such as "Select a Company" for the first item since an...
1
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.