DetailsView updates unused properties to null

DetailsView updates unused properties to null

am 20.01.2008 01:31:58 von Nick Bennett

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?

RE: DetailsView updates unused properties to null

am 20.01.2008 21:13:00 von mily242

Howdy,

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

Regards
--
Milosz


"Nick Bennett" wrote:

> 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?
>
>
>

RE: DetailsView updates unused properties to null

am 23.01.2008 03:11:41 von rodoopus

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.
--
aaa


"Nick Bennett" wrote:

> 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?
>
>
>