473,662 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Formview and ObjectDataSourc e Update method

Hi,

Why does the Update method of an ObjectDataSourc e class requires
parameters for each of the Bind input controls of a FormView?

I have a class (say MyObjectDataSou rce) that is being used as an
ObjectDataSourc e for a FormView control. MyObjectDataSou rce has public
properties that correspond to db table columns and are also used to <
%# Bind("")%Input controls in the formview declaratively.
There is an Update method in MyObjectDataSou rce that requires a
parameter for each and every Bind server controls. Otherwise I get a
server error that reads something like this

ObjectDataSourc e 'MyObjectDataSo urce' could not find a non-generic
method 'MyUpdateMethod ' that has parameters: param1, pram2 and on and
on till it lists all the public properties to which the server
controls are bind.

I thought It was a given that the Update method should inherently know
about the Bind controls as they are bind to the public properties in
the same class of which the Update method is part of.

Am I doing something wrong or is there a need for design improvement
in Asp .Net in this regard.

thanks!
Jan 7 '08 #1
2 2626
On 7 Jan, 18:36, Aamir Ghanchi <aamirghan...@g mail.comwrote:
Hi,

Why does the Update method of an ObjectDataSourc e class requires
parameters for each of the Bind input controls of a FormView?

I have a class (say MyObjectDataSou rce) that is being used as an
ObjectDataSourc e for a FormView control. MyObjectDataSou rce has public
properties that correspond to db table columns and are also used to <
%# Bind("")%Input controls in the formview declaratively.
There is an Update method in MyObjectDataSou rce that requires a
parameter for each and every Bind server controls. Otherwise *I get a
server error that reads something like this

ObjectDataSourc e 'MyObjectDataSo urce' could not find a non-generic
method 'MyUpdateMethod ' that has parameters: param1, pram2 and on and
on till it lists all the public properties to which the server
controls are bind.

I thought It was a given that the Update method should inherently know
about the Bind controls as they are bind to the public properties in
the same class of which the Update method is part of.

Am I doing something wrong or is there a need for design improvement
in Asp .Net in this regard.

thanks!
Hi

Does the data row being updated have a unique key, and if so is it
named in the DataKeyNames property of the Formview?
Jan 7 '08 #2
Hi Phil,

Yes it is a unique key and is in the DataKeyNames property of the
Formview.

Thanks.

On Jan 7, 12:51*pm, Phil H <goo...@philpha ll.me.ukwrote:
On 7 Jan, 18:36, Aamir Ghanchi <aamirghan...@g mail.comwrote:


Hi,
Why does the Update method of an ObjectDataSourc e class requires
parameters for each of the Bind input controls of a FormView?
I have a class (say MyObjectDataSou rce) that is being used as an
ObjectDataSourc e for a FormView control. MyObjectDataSou rce has public
properties that correspond to db table columns and are also used to <
%# Bind("")%Input controls in the formview declaratively.
There is an Update method in MyObjectDataSou rce that requires a
parameter for each and every Bind server controls. Otherwise *I get a
server error that reads something like this
ObjectDataSourc e 'MyObjectDataSo urce' could not find a non-generic
method 'MyUpdateMethod ' that has parameters: param1, pram2 and on and
on till it lists all the public properties to which the server
controls are bind.
I thought It was a given that the Update method should inherently know
about the Bind controls as they are bind to the public properties in
the same class of which the Update method is part of.
Am I doing something wrong or is there a need for design improvement
in Asp .Net in this regard.
thanks!

Hi

Does the data row being updated have a unique key, and if so is it
named in the DataKeyNames property of the Formview?- Hide quoted text -

- Show quoted text -
Jan 7 '08 #3

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

Similar topics

5
2185
by: Jurgen Appelo | last post by:
I'm at a loss here... My FormView control automatically performs a databind at each postback on the server. But in some cases I don't want this to happen. Like when the business layer decides that some of the information in the controls cannot be accepted. But then the FormView binds to the datasource again, and the input in all contols is lost. And the user will have to type it all over again. In ASP.NET 1.1 we could simply say: If Not...
3
3418
by: Jurgen Appelo | last post by:
I asked this question earlier, but unfortunately the two replies I got did not solve the problem. Here it is again, but now with the code: After an Update my FormView always loses its viewstate values. The field values in the FormView are always overwritten by the results of the Update method in the business layer. No matter what I do, the databind always takes place, even when I don't want it to. See the example below. This is a...
0
4741
by: ThePurpleCat | last post by:
Hi, I'm a newbie to ASP.NET programming but not to Visual Studio. I'm having trouble getting my Master-Details page to work. I have a page enabled GridView which is linked to a FormView control through an objectdatasource. The paging on my GridView works fine except that when I change the page the FormView does not update. I tried setting the selectedindex to 0 in the GridView's PageIndexChanged event and manually binding the formview...
0
1224
by: sanjeev06 | last post by:
When Updating using a FormView and ObjectDataSource, the formview always does the data-binding of its controls and the field values in the FormView are always overwritten by the results of the Update method. This behavior is fine when update method succeeds. But the problem is that when for some reason (e.g. a business rule "start date can not be prior to 1/1/2006") business layer rejects the data and Update method returns False (or...
1
6563
by: Pao | last post by:
I have a formview bounded to an objectdatasource. All ok but I have some trouble with a checkbox: when I am in update mode and I update the record, this field is never updated (no errors thrown). The field bounded in the database (MySql) is a string field (ENUM('True','False') default 'False'. The checkbox is correctly bounded in the itemtemplate and in the edititemtemplate.
0
1184
by: andy | last post by:
I have an object. Theres a get, update, insert (etc) method for this The Get rturns an IList which I bind to a formview via objectdatasource. In the get method I store the object in session once I have it, naming it object+id. I first check to see if the object is in session and I return that if it's already cached. On insert update and delete I clear the objet out of session cache.
0
1987
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post by:
Hello, I read some msdn and other articles about how does databinding among DataSource controls and FormView / GridView controls works but I still don't fully understand to this blackbox. I have few questions and hopefully you can provide me some answers. 1. Best place for DataBinding. Where is the best place for calling DataBind method? Is it possible to say don't bind controls for this postback and use current values instead? These...
8
11965
by: =?Utf-8?B?QXNo?= | last post by:
Hi, I have an object, for example User. User contains various properties which i have been able to bind to successfully using wizards and the form view. However if the class User has a property which is not a string, for example a custom type Address which contains properties such as StreetAddress, City, County, Country etc how do i bind to those properties on the same form view? I have tried doing Bind("Address.StreetAddress") but...
3
8094
by: KaOne | last post by:
Hi All, excuse me in advance for my not very perfect english. I need some help about a problem with a FormView bounded to an ObjectDataSource. In practise I have an ObjectDataSource that uses some BLL methods that implements the optimistic concurrency by a TimeStamp field into the DB. So, when I execute an insert, update or delete query if I receive 0 like return value from that queries I understand that a concurrency problem is occurs so...
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
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
7367
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
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
4180
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
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
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
2
1752
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.