473,847 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ObjectDataSourc e UpdateMethod question

I have a FormView that shows details of a specific record on a table. The
SelecMethod returns a DataSet that includes all the fields from my Event
table and other read-only fields from linked tables. My FormView has
controls that are bound to the fiuelds on the dataset table. I am now
changing the FormView's Default Mode to Edit but I am having problems with
the related fields.

My ObjectDataSourc e is defined as:

<asp:ObjectData Source ID="ObjectDataS ourceEventDetai ls"
runat="server" OldValuesParame terFormatString ="original_{ 0}"
SelectMethod="S electEventDetai ls" TypeName="Event Data"
DataObjectTypeN ame="System.Dat a.DataSet" UpdateMethod="U pdateEventDetai ls">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Grid ViewEvents"
Name="eventID" PropertyName="S electedValue"
Type="Int64" />
</SelectParameter s>
</asp:ObjectDataS ource>
The EventData.Selec EventDetails performs a join with related tables and
returns a single table in a dataset with both the Event fields and the
related fields.

The EventData.Updat eEventDetails funcion takes as parameters the
original_EventI D and only the editable fields that belong to the Event
table.

public void UpdateEventDeta ils(long original_EventI D, byte SendState,
string EntryNotes)
I added a button to save changes and when the button is pressed I called:
FormView1.Updat eItem(true);
When UpdateItem is called I receive the following exception:

Could not find a property named 'ImageIndex' on the type specified by the
DataObjectTypeN ame property in ObjectDataSourc e
'ObjectDataSour ceEventDetails' .

ImageIndex is a field found on a related table which is not updated by
UpdateEventDeta ils.

I am not sure if I should limit the SelectMethod to return the table and
do the databinding for the read only fields a different way.

Thanks

Jeronimo Bertran
May 29 '06 #1
3 3557
Hi Jeronimo,

Thank you for your post!

ObjectDataSourc e.DataObjectTyp eName is used to get or set the name of a
class that the ObjectDataSourc e control uses for a parameter in an update,
insert, or delete data operation, instead of passing individual values from
the data-bound control.

Since your UpdateMethod of ObjectDataSourc e is passing individual values,
you should remove 'DataObjectType Name="System.Da ta.DataSet"' part from your
ObjectDataSourc e declaration.

For more information, see MSDN documentation on this property:
http://msdn2.microsoft.com/en-us/lib...rols.objectdat
asource.dataobj ecttypename(d=i de).aspx

Hope this helps. If anything is unclear, please feel free to post here.
Regards,
Walter Wang
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

May 30 '06 #2
Thanks Walter
May 30 '06 #3
You are welcome.

Have a nice day!

Regards,
Walter Wang
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

May 31 '06 #4

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

Similar topics

5
1993
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as parameter. When the Update-method is invoked by the ObjectDataSource, the object referenced is not the same object returned by the Select-method, but a new object with only the values from the Edit-template. So basically I get a reference to a useless...
13
8234
by: anonymike | last post by:
Hello, I started working with the ObjectDataSource today. I have the select, and have been working on getting the update method to work. Here is the asp code for my Data source: <asp:ObjectDataSource ID="dsourceApps" runat="server" SelectMethod="getAllApplications" TypeName="AppMgr.AppManager" UpdateMethod="updateAppHdr" ConflictDetection="CompareAllValues"
1
1852
by: Bruno Alexandre | last post by:
Hi guys, I want to create an ObjectDataSource from a DataTable in Profile web.config <profile> <properties> <add name="CartItems" type="System.Data.DataTable" /> </properties> </profile>
2
3930
by: J055 | last post by:
Hi I have a method with the following signature: public bool UpdateSetAccounts(int items) { } How do I pass a collection of selected values in a ListBox to this ObjectDataSource UpdateMethod? I can pass the ListItemCollection in a ControlParameter, e.g.
0
1539
by: =?Utf-8?B?RGVubmlzIE1jQ2FydGh5?= | last post by:
I am displaying data from a web service in a DataGrid, using an ObjectDataSource. Retrieving and displaying data is working fine, but there is a problem using Edit mode in the GridView. If my GridView contains columns that correspond exactly to the input parameters for the UpdateMethod of the ObjectDataSource, then everything works. However, there are some columns in the DataGrid that should be invisible or read-only. When I set the...
1
1708
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I really hope this is not a case of "this silly thing will never work".....lots of time invested in troubleshooting this already. I have created a standard ASP.NET web form (.aspx) with several collections of textboxes prompting for entry into a fairly monolithic database. I decided to create a business object (called Employee) and use the ObjectDataSource to broker data being transmitted between the UI and my Employee object (and...
0
5525
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to code what I think is a fairly typical Master/Detail scenario with two GridViews, using AJAX. Using the Northwind sample, I have two ObjectDataSources - one which pulls data from the Orders table, and one that pulls the related data from . Each...
9
8857
by: Kernel Bling | last post by:
Hi Everyone, This Saturday the stage was set. The problem simply could not go on existing -- it had to be solved. Many hours, articles, compilations and frustrations later I still did not find an answer. Even pacing around my flat until I nearly went into an altered state of reality proved futile. So here is the problem... When I link up the ObjectDataSource UpdateMethod to a method in the
0
4290
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't want to have my parameter names in those methods have to be "original_Parametername" or even if I change the OldValuesParameterFormatString to get rid of the "original" I would still have just "Parametername". I think most people user parameters...
0
9734
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10995
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10654
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10718
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7061
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5729
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3168
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.