Update Using Objectdatasource Via Class And Dataset Not Working?
Jul 22, 2010
i try to update the gridview i keep on getting the error like objectdatasource could not find a non generic method 'update' which has parameters a,b,c etc.i have done everything right but i cant seem to figure this one out.i am using objectdatasource,a class file and a dataset.xsd file.
[code]...
View 2 Replies
Similar Messages:
Mar 9, 2010
Here is the "Update" method which is not updating.
It works if I remove "@original_UnitPrice" and "@original_OnHand" parameters from the "WHERE" clause.
[Code]....
View 2 Replies
Oct 18, 2010
I have an ObjectDataSource that I want to perform updates using a business entity i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form viaother properties of the control):
Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating
Dim entity As New Login()
Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo)
entity = accountControl.Entity
e.InputParameters.Add("entity", entity)
End Sub
And here's the markup for the datasource:
<asp:ObjectDataSource ID="MasterDataSource" runat="server" EnableCaching="true" CacheDuration="10"
SelectMethod="SelectAll" UpdateMethod="Update" TypeName="Data.DAL.LoginDAL">
</asp:ObjectDataSource>
My question is, how can I get the update method to pass this entity to the update method in my BLL class? It seems the Update method requires an ID or reference to the original object to use in determining whether any changes have taken place, but I don't really want to do this. In other words, I just want to use the Update event on my ObjectDataSource to pass my entity to the method ("Update") I set as a property and then let this business method handle the update of the data. Shown below, is the BLL update method I want to call:
Public Overloads Function Update(ByVal entity As Login)
If entity Is Nothing Then
Throw New ArgumentNullException("entity")
End If
MyBase.Update("UpdateLogin", entity.Username, entity.Password, entity.FirstName, entity.LastName, entity.Role, entity.Region, _
entity.Email, entity.Title, entity.TierID, entity.Street, entity.City, entity.State, entity.Zip, entity.Mobile, entity.Phone, entity.Fax)
End Function
When I try to call this as it stands now, I get an error: ObjectDataSource 'MasterDataSource' could not find a non-generic method 'Update' that has parameters: ID, entity. Previously, I'd set up a long list of parameters of basic data types (string, int, boolean), but this is rather cumbersome and I was hoping to use an entity for this (FYI, I also got the same type of error when I tried this approach, but with the ID as the
last parameter in the list). Perhaps what I'm doing here is atypical to how the ODS is normally used?? Has anyone done something like this successfully?
View 1 Replies
Jan 23, 2011
I've done a lot of searching on this her on SO but I can't seem to find anyone who has done this. I'm sure it's a common problem but I can't figure out the right keywords to search for the solution so I'm sorry if this is a duplicate.I have a dataset where I've used the Generate Insert, Update, and Delete statements as well as the Refresh the Data Table options so that I can retrieve the last inserted ID when I'm using an ObjectDatasource.however, when I'm handling the ObjectDataSource-Inserted method, I'm getting a 1 as a return value, which I assume is the affected rows. I don't want that, I want the ID so that I can use it in my code.I looked at the generated code for the insert method and it is doing a SELECT after inserting, but it returns the whole row not the ID, so how can I get at this row to retrieve the value?
View 1 Replies
Sep 25, 2010
How do I populate a dataset with an Objectdatasource?
The reason is I have an Objectdatasource on a page which is populating a GridView ok.
I want to use a Dataset to control the DayRender of a Calendar Control and don't want to query the database again as the right date info is already in the Objectdatasource.
So can i populate a dataset with the objectdatasource ??
View 11 Replies
Jan 23, 2011
I've done a lot of searching on this here but I can't seem to find anyone who has done this. I'm sure it's a common problem but I can't figure out the right keywords to search for the solution so I'm sorry if this is a duplicate.I have a dataset where I've used the Generate Insert, Update, and Delete statements as well as the Refresh the Data Table options so that I can retrieve the last inserted ID when I'm using an ObjectDatasource.however, when I'm handling the ObjectDataSource-Inserted method, I'm getting a 1 as a return value, which I assume is the affected rows. I don't want that, I want the ID so that I can use it in my code.I looked at the generated code for the insert method and it is doing a SELECT after inserting, but it returns the whole row not the ID, so how can I get at this row to retrieve the value?
View 6 Replies
Feb 15, 2010
I have a dataset with several tableAdapters in it. For some reason, one of them that I created doesn't show up when I try to put it into my objDataSource?
I can access and use it from codebehind (testing purposes for this post.
View 1 Replies
Nov 15, 2010
I have an ObjectDataSource in Visual Studio 2008. I have a DataSet defined with a TableAdapter. However, when I go to select the Table Adapter to use in the ObjectDataSource, nothing shows up. I double checked that the DataSet is in fact in the App_Code folder. I do not know what else to try. The following code is the ASP code for that ObjectDataSource:
asp:ObjectDataSource
ID="ObjectDataSource1"
runat="server"
DeleteMethod="Delete"
InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData"
TypeName="NewDataSetTableAdapters.PlansTableAdapter"
[Code].....
View 1 Replies
Mar 25, 2011
I fill a GridView from a ObjectDataSource that points to a Typed DataSet.
I need to read a couple of row columns from the object data source that IS NOT part of the Gridview.
So far, I have found out that ObjectDataSource.ObjectDataSource_Selected is the right event to do this.
Examples on the internet refers to e.OutputParameters, but that appears to be empy even though rows are returned.
e.ReturnValue seem to contain a type related to the row type, but I cannot interpret this either.
View 1 Replies
Jul 28, 2010
i created an objectdatasource and bind DetailView to it.i want to set the objectdatasource.datasource to a object (for example Member class that is an Entity) it means that i want to show just one record to this with my custom method that is MemberModel.GetMemberByNationalID(string nationalID)
View 1 Replies
Aug 3, 2010
I have a gridview I want to populate with an ObjectDataSource.Problem is, when I use the wizard, I cannot find the page the ObjectDataSource belongs to, in the business object list. I can see the classes in the App_Data and App_Code, but I want to use a method in this current page΄s codebehind class.
View 5 Replies
Jul 28, 2010
ObjectDataSource cannot find ProductsBLL Class(with "show only data component" unchecked)?ProductsBLL.cs is located at the root of the project.
View 1 Replies
Jan 11, 2011
[Code]....
The object 'lst' is filled correctly with data. I have List<string> items in AName and DurationTime.I don't have an error, but I don't have any results.
View 16 Replies
Dec 21, 2010
I have a detailsview, template as follows:
[Code]....
Codebehind: creating dataset, getting data from sql with adaptor and filling into dataset object, then setting detailsview's datasource.
I add 2 button to above template to able to edit data at asp page, and added event handlers:buttons:
[Code]....
My question is, what to do inside the detailsview update event function to able to edit and update data. My method can be wrong too.
View 7 Replies
May 21, 2010
I mean, what is the faster way to get as fast as I can more than one table with stored procedure? Is there any study what is faster and why? There is a big problem getting more than one table at once with Entities, so the only way is DataSet. But I was told DataSet work very slow. Is that true?
View 2 Replies
Aug 9, 2010
I have the following situation:My business class:
public class Foo
{
public String A {get;set;}
public DateTime B {get;set;}
// .. and other properties like
public String Intern {get;set;}
}
I'm binding that Item to a DetailsView in Editmode. (I bind a List containing a single object of Foo, becuase I do recall that I can only bind IEnumerable<> classes to the DetailView)The binding is done via a ObjectDataSource
View 1 Replies
Mar 10, 2010
I am trying to update record in GridView. But ObjectDataSource is creating original_{0} and new vlaue object (exactly the same).ObjectDataSource.UpdateMethod is as follows
[Code]....
The paremeters ("original_ProductBO" and "productBO") in the above function are supposed to have different values since I am editing record in GridView and then updating it.I have the checked the query by hard coding parameter values and it works. In the ObjectDataSource_Updating(..) event, I cheked the parameters ("original_ProductBO" and "productBO") , I am getting the same values. Can anyone tell why tow parameters have the same values when I am editing record in GridView Code for the ObjectDataSourec and GridView is attached below
[Code]....
[Code]....
View 3 Replies
Apr 22, 2010
[code]....
Select method returns array of strings . But How I need to appear selected node for edit delete methods get this string (userName) ?
for methods like :
[DataObjectMethod(DataObjectMethodType.Delete, true)]
static public DeleteMember(...
View 1 Replies
Jun 20, 2010
i have an instance of ObjectDataSource with specified update method. But on update i have an old values(previously set in gridview) in method - they are not updating.
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeletePayment"
InsertMethod="InsertPayment" SelectMethod="GetPayments" TypeName="CostsReportControl.Models.Payments"
UpdateMethod="UpdatePayment" OldValuesParameterFormatString="{0}_old">
<SelectParameters>
<asp:Parameter Direction="input" Type="string" Name="sortExpression" />
<asp:Parameter Direction="input" Type="string" Name="sortDirection" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
SelectMethod="GetList" TypeName="CostsReportControl.Models.PaymentTypes">
</asp:ObjectDataSource>
my update method
public void UpdatePayment(int Id,string Fullname,DateTime Date, string Sum, string PaymentType, string RecordInfo,int Id_old)
View 2 Replies
Feb 16, 2010
http://msdn.microsoft.com/en-us/library/ms178538(VS.80).aspx ?I tried and got error as below, at clicking Update button in detailView
'/CaseExamples' μμ© νλ‘κ·Έλ¨μ μλ² μ€λ₯κ° μμ΅λλ€. ==> Server error in application program
ObjectDataSource 'EmployeeDetailsObjectDataSource'μμ λ§€κ° λ³μ (LastName, FirstName, Address, City, Region, PostalCode, original_FirstName, original_LastName, original_Address, original_City, original_Region, original_PostalCode, original_EmployeeID)λ₯Ό μ¬μ©νλ
μ λ€λ¦μ΄ μλ UpdateEmployee' λ©μλλ₯Ό μ°Ύμ μ μμ΅λλ€.
View 3 Replies
May 16, 2010
Hi,
I'm attempting to develop an n-tier web application that makes use of the ObjectDataSource on a page. The page shows the classic 'user details' page to allow create, read, update and delete actions for an object within the users collection. Let me explain
that again as I think it might be the root of my issue. I have a class named 'user', I also have a class named 'users' which exposes a list of 'user' objects. It's this 'users' class that is the source of my ObjectDataSource control.
What i'm hoping to have happen is that the page will display a 'user' object from the 'users' class (which it does) and that the end user can then amend the values in a formview before updating them (it kind of does this). The problem I'm running into is
that all the 'user' objects are getting updated with th ealtered values and not just the currently displayed object. I suspect that this has something to do with the web being stateless, but i'm going 'round in circles trying to figure out where i'm going
wrong.
I can post code if required, but what i'm looking for is a decent (read as: easy to follow/understand) site where I can get a better understanding of what i'm supposed to be doing.
My environment is VS2010, C#, .NET 2.0, but I don't think the environment is the issue, merly the chair-keyboard interface.
Thanks,
Mike
View 13 Replies
Mar 19, 2010
Can you post of an example of Gridview with EditItemTemplate using ObjectDataSource as data connectionand Update the the specific row. Ihave lots of sleepness night with this problem.
View 2 Replies
Jun 23, 2010
I've a form view with various field in edit and an object datasource where I've defined my update parameters that my update method takes. I've set some of the fields in the edit template to read only because I want them to display.
Unfortunately they are getting passed in as update parameters somehow to my objectdatasource.
So, it is generating update parameters that causes my method to not match.
How can I exclude these parameters from getting sent to update?
View 1 Replies
Mar 11, 2010
error "ObjectDataSource 'ObjectDataSourceCaseDetails' could not find a non-generic method". I have an update method and my ObjectDataSource is hooked up to the method in my BLL. review my code below
[Code]....
[Code]....
View 1 Replies
Jan 22, 2011
I'm having a problem with a FormView control that I have bound to an ObjectDataSource. The problem is that the FormView control is not automatically filled in with the public properties of the object linked by an ObjectDataSource control when I select refresh schema. Everything compiles and I can add fields manually, but there are a lot of properties in the class and I do not want to deal with adding all the fields by hand. It's not the end of the world of course if I have to add them manually, but I'm bothered more by the fact that it doesn't act the other formviews.
Has anyone ever experienced a problem like this? I have other objectdatasource controls with other formviews that properly refresh their schemas. I noticed that in the objectdatasource control that is giving me problems, the DataObjectTypeName field is not automatically set as it is in the others. However, after adding it manually it still doesn't refresh the schema. I'm using Visual Studio 2010. Defined in .aspx page:
[Code]....
The SPFModuleBLL class contains the GetModule2() method which is shown here:
[Code]....
View 3 Replies