ObjectDataSource UpdateMethod - Databound fields empty

P

Philip

I am using the ListView/ObjectDataSource and the UpdateMethod provides null
value fields for the databound fields other than the DataKeyName specified in
the companion ListView. This is true regardless of whether I use a custom
object (DataObjectTypeName)....or whether I use the UpdateParameters template.

In order to workaround the problem I have to support the ObjectDataSource
OnUpdating event....then find the controls in question and build the input
parameters myself.....so that the UpdateMethod input parameters are correct.

I have written a sample application which reproduces the condition, however
I see no way to update the project.

Can you offer any advice ?
 
S

Stan

I am using the ListView/ObjectDataSource and the UpdateMethod provides null
value fields for the databound fields other than the DataKeyName specified in
the companion ListView.  This is true regardless of whether I use a custom
object (DataObjectTypeName)....or whether I use the UpdateParameters template.

In order to workaround the problem I have to support the ObjectDataSource
OnUpdating event....then find the controls in question and build the input
parameters myself.....so that the UpdateMethod input parameters are correct.

I have written a sample application which reproduces the condition, however
I see no way to update the project.

Can you offer any advice ?

Are you sure that the parameters are configured to take their input
from the ListView control? When setting up an ObjectDataSource using
the Configure DataSource wizard, the commands are named and any
parameters required by the Select method are assigned but the
parameters for Delete, Update and Insert have to be configured
separately. In design view this can be done via the properties window
by clicking on the button in each of the parameter properties for the
command. In this case you would need to select Control, and the
ListView for each parameter (DataBound controls within the ListView
will then automatically become the source for the respective DataBound
fields even though the Parameter settings only indicate
"SelectedValue" for the ListView control).

HTH
 
P

Philip

Here are my UpdateParameters...


<UpdateParameters>
<asp:parameter Name="ContentKey" Type="String" />
<asp:parameter Name="ContentID" Type="String" />
<asp:parameter Name="Description" Type="String" />
</UpdateParameters>


If I examine the InputParameters within the ODS OnUpdating event, all three
have keys in the collection, however only the ListView DataKeyName field has
a valid value, the other two databound fields have null values.

Thanks for your help.

Any further suggestions ?
 
P

Philip

Also....the UpdateParameters listed should originate from the databound
values (using the Bind() syntax, etc) and not from Session data, Query
String, or Control, etc.

Please advise on suggestions. You help is appreciated.
 
P

Philip

Any further thoughts on this problem ?

Please advise....I need to resolve this problem.

As I indicated in my original post....I have a sample project which
reproduces the problem.
 
S

Stan

Here are my UpdateParameters...

                                <UpdateParameters>
                                        <asp:parameter Name="ContentKey" Type="String" />
                                        <asp:parameter Name="ContentID" Type="String" />
                                        <asp:parameter Name="Description" Type="String" />                                            
                                </UpdateParameters>

If I examine the InputParameters within the ODS OnUpdating event, all three
have keys in the collection, however only the ListView DataKeyName field has
a valid value, the other two databound fields have null values.

Thanks for your help.

Any further suggestions ?

Dear Philip

I can see the problem which is much as I suspected. Suppose your
ListView control has an ID "TheListView" Then the description
parameter, for example, should be like this:

<asp:ControlParameter ControlID="TheListView" Name="Description"
PropertyName="SelectedValue" type="String" />

HTH
 
P

Philip

Stan,

I appreciate your prompt response....however this suggested set of
ControlParameters produces the same results. The ListView DataKeyName field
is provided in the ODS UpdateMethod, however the other two fields
(Description and ContentID) are both nulls. All three fields participate in
two-way data binding.

I have a project sample that I will be glad to share with you. This
project is small, however does reproduce the problem.

Can I send you the project ?
 
P

Philip

Any chance of getting more feedback on this ODS problem ?

As noted previously I have a small project which reproduces the problem.

I will be glad to send it to you.
 
P

Philip

Can I not get a response for this continuing ODS UpdateMethod problem ?

Come on....I need to get this resolved.
 
A

Ash Shah

Hey Philip,

I have what seems to be a very similar problem. Did you ever get this resolved? I have struggled for 2 days with it and cannot figure out why Null values are being passed to my UpdateMethod.

Here's hoping you can help me out.

Thanks,

Ash



phili wrote:

Re: ObjectDataSource UpdateMethod - Databound fields empty
17-Jul-08

Can I not get a response for this continuing ODS UpdateMethod problem

Come on....I need to get this resolved

--
Phili

:

EggHeadCafe - Software Developer Portal of Choice
WPF DataGrid Custom Paging and Sorting
http://www.eggheadcafe.com/tutorial...f-32b2d802ae17/wpf-datagrid-custom-pagin.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top