Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

DetailsView updates unused properties to null

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nick Bennett - 20 Jan 2008 00:31 GMT
I've got a page with a DetailsView.  It uses a SqlDataSource which itself
uses stored procedures for Select and Update.

I don't want the user to see some of the columns, but if I don't bind them
(or if I do bind them but set Visible=False), when the Update procedure is
called, the parameters corresponding to the columns that weren't bound to
the DetailsView are all null.

This can't be an uncommon scenario, so I guess I have missed something.  Any
ideas?
Milosz Skalecki [MCAD] - 20 Jan 2008 20:13 GMT
Howdy,

Take a look at BoundField's InsertVisible property as well as SqlDataSource
Updating/Inserting events.

Regards
Signature

Milosz

> I've got a page with a DetailsView.  It uses a SqlDataSource which itself
> uses stored procedures for Select and Update.
[quoted text clipped - 6 lines]
> This can't be an uncommon scenario, so I guess I have missed something.  Any
> ideas?
Angel - 23 Jan 2008 02:11 GMT
Using BoundField might help but keep in mind that things get really ugly when
you mix Declarative stuff and code.  My suggestion to you is go completely
code replace the sqldatasource with a dataset or datatable and user the
datasource property instead.  

Where it get tricky is if you have dropdowns or any other template based
field it can get a little hard to do but is doable I have a demo depicting a
dynamic situation
similar to the one you are describing. Mine involves a detailsview and
Gridview in a master/details relationship.  One page hitting multiple table
and columns are defined at runtime.

If you are interested let me know and I will be glad to share this with you.
Signature

aaa

> I've got a page with a DetailsView.  It uses a SqlDataSource which itself
> uses stored procedures for Select and Update.
[quoted text clipped - 6 lines]
> This can't be an uncommon scenario, so I guess I have missed something.  Any
> ideas?
Paul Shapiro - 11 Feb 2008 19:34 GMT
You could use a stored procedure which did not include parameters for the
columns you don't want updated.

An asp:Boundfield has a ConvertEmptyStringToNull property. Have you tried
setting that to false?

> I've got a page with a DetailsView.  It uses a SqlDataSource which itself
> uses stored procedures for Select and Update.
[quoted text clipped - 6 lines]
> This can't be an uncommon scenario, so I guess I have missed something.
> Any ideas?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.