473,406 Members | 2,390 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,406 software developers and data experts.

form detailview question

GS
in Windows form, I have Datagridview and detailview with the same binding
data manager. upon clicking the + in the navigator, the primary key field is
blank as expected, but I need to enable it for new record to let user to
fill it. On the other hand I don't want to allow change to the field for
existing record. so disable that on existing non new record. How do I do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.
Dec 14 '07 #1
4 1371
Are you sure that allowing the user to fill the primary key is a good idea?
These are often left to the database and the insert statement will often
accept all fields _except_ the primary key which is often, by convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same binding
data manager. upon clicking the + in the navigator, the primary key field
is
blank as expected, but I need to enable it for new record to let user to
fill it. On the other hand I don't want to allow change to the field for
existing record. so disable that on existing non new record. How do I do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.

Dec 14 '07 #2
GS
Ordinarily, no.
this form deals with only a small number of named entries possibly less than
50.
the name field is only 16 characters.

and the users using this form is either developer or advanced users trying
to customize the application data extraction pattern.

I suppose I could generate primary key and have unique index on name
field.. however in the application the references are by name not by other
key for ease of use and maintenance by user.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:3A**********************************@microsof t.com...
Are you sure that allowing the user to fill the primary key is a good
idea?
These are often left to the database and the insert statement will often
accept all fields _except_ the primary key which is often, by convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same
binding
data manager. upon clicking the + in the navigator, the primary key
field
is
blank as expected, but I need to enable it for new record to let user to
fill it. On the other hand I don't want to allow change to the field for
existing record. so disable that on existing non new record. How do I do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.

Dec 15 '07 #3
I think that even with advanced users, the primary key is best left to some
automated process. User entered data tends to be subject to abuse, like
someone calling all their entries "fred" or such.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:OT**************@TK2MSFTNGP03.phx.gbl...
Ordinarily, no.
this form deals with only a small number of named entries possibly less
than
50.
the name field is only 16 characters.

and the users using this form is either developer or advanced users trying
to customize the application data extraction pattern.

I suppose I could generate primary key and have unique index on name
field.. however in the application the references are by name not by
other
key for ease of use and maintenance by user.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:3A**********************************@microsof t.com...
>Are you sure that allowing the user to fill the primary key is a good
idea?
>These are often left to the database and the insert statement will often
accept all fields _except_ the primary key which is often, by convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same
binding
data manager. upon clicking the + in the navigator, the primary key
field
is
blank as expected, but I need to enable it for new record to let user
to
fill it. On the other hand I don't want to allow change to the field
for
existing record. so disable that on existing non new record. How do I
do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.


Dec 15 '07 #4
GS
then it is the users wish to go against company policy to make meaningful
name. and he is going to suffer from the potential gain of meaning.
autogenerated key has no meaning neither. for alpha key in large table,
wide scatter of key values help performance but I double if small number of
similar key name make much difference in small tables of 100 entries or
less.

Furthermore, as long as the entry is not referenced, user will be allowed to
rename, change, delete. Once the entry is referenced , no change is allowed.
except for the admin person.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:D0**********************************@microsof t.com...
I think that even with advanced users, the primary key is best left to
some
automated process. User entered data tends to be subject to abuse, like
someone calling all their entries "fred" or such.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:OT**************@TK2MSFTNGP03.phx.gbl...
Ordinarily, no.
this form deals with only a small number of named entries possibly less
than
50.
the name field is only 16 characters.

and the users using this form is either developer or advanced users
trying
to customize the application data extraction pattern.

I suppose I could generate primary key and have unique index on name
field.. however in the application the references are by name not by
other
key for ease of use and maintenance by user.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:3A**********************************@microsof t.com...
Are you sure that allowing the user to fill the primary key is a good
idea?
These are often left to the database and the insert statement will
often
accept all fields _except_ the primary key which is often, by
convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same
binding
data manager. upon clicking the + in the navigator, the primary key
field
is
blank as expected, but I need to enable it for new record to let user
to
fill it. On the other hand I don't want to allow change to the field
for
existing record. so disable that on existing non new record. How do I
do
that?
I notice the property of the fields are enabled in the form design,
but
could not find any code for disable them.



Dec 17 '07 #5

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

Similar topics

0
by: Mike | last post by:
I have a detailview, with several template columns in it. It's setup so that a user views info from a datagrid, and if they want to add another row, they click a button. The button causes a...
2
by: momo | last post by:
Guys, I am trying to created a detailview that displays several records at a time. Let's say I have a GridView with checkboxes and when I check two checkboxes and click a button, I want it to...
0
by: Luqman | last post by:
I have used a single objectDataSource for GridView and DetailView, and when I load the page, the GridView shows all the entries of Invoice, and DetailView shows the 1st entry of Invoice, thats all...
0
by: =?Utf-8?B?THVib21pcg==?= | last post by:
Hi, I have a GridView and Dataview controls. If user clicks on a row in GridView, the details will be shown in DetailView. 1/ I want to show in DetalView only details field - without column...
0
by: Deepak Palkar | last post by:
Hi I have Gridview and DetailView both on one page. I am showing the list in the Gridview and the particular record in DetailView. the problem is When i EDIT on the DetailView and try to UPDATE...
2
by: Luqman | last post by:
Hi, Any Idea how to Display Todays Date in DetailView Template Field while Inserting ? For example: When I click on New Button of DetailView Control, I need to display Today's Date in a...
0
by: LamSoft | last post by:
By Double clicking the object detailview, it will auto make a sub-procedure called XXXXX_Selecting, however I want a sub-procedure to be called while the detailview is being updated, so that i add...
0
by: LamSoft | last post by:
In the object of detailView, i added a function to check the values during itemUpdating, the source is: protected void test2(object sender, DetailsViewUpdateEventArgs e) { foreach...
1
by: Ganesh | last post by:
Hi There, I use detailView to edit, insert and delete data. It gets value from datagrid.selectedvalue. How can i insert a record initially. If there is not any record in the grid, still i would...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.