ObjectDataSource Calls Update Method With Old Values?

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


Similar Messages:

DataSource Controls :: Benefits Of Using ObjectDataSource Over Normal Method Calls?

Jul 6, 2010

In my application at some places we have used ObjectDataSource and at other normal method calls to retrieve data.My question is then what exactly are the benefits of using ObjectDataSource ?In the example below "CODE ONE" makes a call to the Business Layer and then Binds the results to the Grid abd "CODE TWO" is using ObjectDataSource to do the same.Then how is ObjectDataSource better?

SuitableApplicant sa = new SuitableApplicant();
IList<HD.Recruitment.SuitableApplicant> list = new List<HD.Recruitment.SuitableApplicant>();
list = HS.Recruitment.RecruitmentService.GetSuitableAppls();
GridView1.DataSource = list;
[code]....

View 5 Replies

DataSource Controls :: ObjectDataSource - Update Method To Pass Entity To The Method In BLL Class?

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

Forms Data Controls :: DetailsView Delete Method Passing Null Values To Objectdatasource Underlying Object Delete Method

Apr 12, 2010

I am using VS 2008 SP1. My also have included CSS Friendly adapter [URL] in my project ( I mentioned this because my GridView Empty data template is not showing when using GridView's CCS Friendly adapter). I have a GridView and a DetailsView. When a record in GridView is selected its details information is shown in the Details View. Type of Data source I am using is ObjectDataSource. My Insert and Update methods works perfectly. It is only the Delete method that is passing null values to the underlying object delete method. My source codes for both the UI, BLL, DAL is shown below

[Code]....

My Business Object code is below :

[Code]....

My Data Access Layer Code is:

[Code]....

View 2 Replies

DataSource Controls :: Update Method In ObjectDataSource Is Not Working?

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

DataSource Controls :: ObjectDataSource Could Not Find A Non - Generic Method Update?

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

Forms Data Controls :: DetailsView's ObjectDataSource Update Method Fails?

Jan 15, 2011

I am using a gridview to select a record and control that record using a details view. I am using a class based objectdatasource to link the data for select, update and delete. Sofar the select works but the update fails. Here is my error message:

ObjectDataSource 'odsDetailsView_1' could not find a non-generic method 'UpdateSet' that has parameters: setId, TYPE, iHPlayer, iAPlayer, iHRuns, iARuns, iH8Break, iA8Break, iHe8s8, iAe8s8, iH15BRn, iA15BRn, iHWins, iAWins, SET_ID, MATCH_FK, HOME_MEMBER_ID_FK, AWAY_MEMBER_ID_FK, HOME_TABLERUN, AWAY_TABLERUN, HOME_8BALLBREAK, AWAY_8BALLBREAK, HOME_E8S8, AWAY_E8S8, HOME_15BRN, AWAY_15BRN, HOME_TOTALWON, AWAY_TOTALWON, HOME_POINTS, AWAY_POINTS, LOCKED, GROUP_FK.

The first group of parameters have lower case letters and they come from my objectdatasources update method parameters. The second group of parameters are all capitalized and they are the fields in my SQL database table (and I don't know how they wound up in the error). This might be a clue.When executing the code my class method never gets the chance to execute because the error pops up before the code gets there.

Here is my objectdatasource:

[Code]....

Here is my detailsview:

[Code]....

Here is my class update method constructor:

[Code]....

View 1 Replies

Forms Data Controls :: Updating Checkbox Value Through ObjectDataSource Update Method

Jan 4, 2011

I am very new to updating the datasource using ObjectDatasource. I have a checkbox on click of update the update method triggers but though teh check box is checked, the value is updated as false.

<asp:TemplateField HeaderText="IsPrimary" SortExpression="IsPrimary">
<EditItemTemplate>
<asp:CheckBox runat="server" ID="chkIsPrimary" Checked='<%# Eval("IsPrimary") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remarks">
<EditItemTemplate>
<asp:TextBox ID="txtRemarks" runat="server" SkinID="longTextBox" TextMode="multiLine"
Text='<%# Bind("Remarks") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>......................

View 2 Replies

DataSource Controls :: ObjectDataSource 'odsDetail' Could Not Find A Non-generic Method 'Update'...

Jan 26, 2011

I try to update the detailview control. got this error messsage.

ObjectDataSource 'odsDetail' could not find a non-generic method 'Update' that has parameters: hospitalID, hospitalName, taxID, address1, address2, city, state, zip.

[Code]....

here's my edit function

[Code]....

View 3 Replies

DataSource Controls :: Use An ObjectDataSource Update Method With A Table - Valued Parameter?

Oct 13, 2010

I'm trying to figure out if it's possible to use an ObjectDataSource Update method with a table-valued parameter. Here's my ODS:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DataObjectTypeName="TestProject.MyTestDataTable"
SelectMethod="GetTestData" TypeName="TestProject.BLL.TestBLL"
OldValuesParameterFormatString="original_{0}"
UpdateMethod="UpdateTestData">
<SelectParameters>
<asp:Parameter DefaultValue="65" Name="testId" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

I bind this to a GridView but I'm not looking to edit row by row. Instead my GridView has a bunch of TemplateFields with textboxes. I also have a Button that when pressed, invokes the Update method of the ODS. So then the "UpdateTestData" function in my TestBLL is called. This looks like this:

public void UpdateTestData(MyTestDataTable dt)
{
QueriesTableAdapter qta = new QueriesTableAdapter();
qta.UpdateTestData(dt);
}

At run-time in debug, it seems like the object for the signature above is not populated with the data from my GridView.

View 1 Replies

Forms Data Controls :: Update Method Objectdatasource And Data Repeater

Jan 4, 2010

I have a datarepeater control on my form. I have a method for updating comments, but I would like it to be exectued when a user clicks a checkbox (inside the datarepeater). The checked value is being "bind" to the checkbox control. Can I use the built in Update Method tied to the objectdatasource?

View 1 Replies

Forms Data Controls :: Detailsview Update Method Not Getting New Values?

Jun 9, 2010

when I click on "update" button of my detailsview I have the same values on my db table.It seems that the update method don't get my new values inserted in the "boundields" in editing mode.Below there is my code.

<asp:DetailsView ID="detailsview1" runat="server" AutoGenerateRows="false" HeaderStyle-Font-Bold="true"

View 2 Replies

AJAX :: Asynchronous Calls To Same Method?

Mar 12, 2010

I am relatively new to asp.net. In My asp.net website, i have a method GetData(int id) which is called Repetitively, depending on id count, GetData is desinged to get data from sharepoint and sql server both. if the Id count is high say =10, my page load time increases because GetData is called 10 times and the page load time keeps adding up. so I want to ask, is there any way that this GetData() be called asynchornously or by the use of some thread, so that my page loads faster.

View 2 Replies

MVC :: Renderaction Calls Wrong Action Method?

Nov 19, 2010

I'm struggling with renderaction, the problem is that it calls the wrong action method on my controller.On my "Users" controller there are two action methods called edit, one for get and one for post requests:

public virtual ActionResult Edit(int id)
{
//return a view for editing the user

[code]...

View 3 Replies

Speed Up A Web Service For Auto Complete And Avoid Too Many Method Calls?

Jun 11, 2010

So I've got my jquery autocomplete 'working,' but its a little fidgety since I call the webservice method each time a keydown() fires so I get lots of methods hanging and sometimes to get the "auto" to work I have to type it out and backspace a bit because i'm assuming it got its return value a little slow. I've limited the query results to 8 to mininmize time. Is there anything i can do to make this a little snappier? This thing seems near useless if I don't get it a little more responsive.

[Code].....

View 5 Replies

AJAX :: AutoCompete Extender Calls Web Method (in Webservice) That Have Zero Parameter?

Jun 11, 2010

I have AutocompeteExtender control in my page.it calls web method (in webservice) that have no parameter I have two web methods in webservice Method 1Geist(string PreText, int Count){....}Method 2GetList(){.......}ethod 2 calls.I want to call method 1.

View 3 Replies

Forms Data Controls :: Formview Insert Adds All Null Values - Update Doesn't Update Values

Apr 12, 2010

I have a typical gridview/formview master control setup. When I try to update or insert I don't get any errors but it also doesn't work. When I try to insert data all I get are null values and when I update, none of the values are updated. The formview looks like its working, but just doesn't. The primary key is an identity and it auto-increments by one.

[Code]....

View 3 Replies

Garbage Collection Of Strings Returned From C# Method Calls In Ascx Pages

Mar 18, 2010

For a web application developed on ASP.NET, we are finding that for user control files (ascx) we are returning long strings as a result of method calls. These are embedded in the ascx pages using the special tags <% %>When performing memory dump analysis for the application, we find that many of those strings are not being garbage collected. Also, the ascx pages are compiled to temporary DLLs and they are held in memory. Is this responsible for causing the long strings to remain in memory and not be garbage collected ?

View 2 Replies

Jquery Dialog Calls A Server Side Method With Button Parameters?

May 27, 2010

I have a gridview control with delete asp:ImageButton for each row of the grid. What I would like is for a jquery dialog to pop up when a user clicks the delete button to ask if they are sure they want to delete it.
So far I have the dialog coming up just fine, Ive got buttons on that dialog and I can make the buttons call server side methods but its getting the dialog to know the ID of the row that the user has selected and then passing that to the server side code. The button in the page row is currently just an 'a' tag with the id 'dialog_link'. The jquery on the page looks like this:

$("button").button();
$("#DeleteButton").click(function () {
$.ajax({

[code]...

The dialog itself is just a set of 'div' tags. Ive thought of lots of different ways of doing this (parameter passing, session variable etc...) but cant figure out how to get any of them working.Any ideas are most welcome

View 1 Replies

C# - ObjectDataSource Could Not Find A Non-generic Method?

Dec 20, 2010

I have this ASP.NET code:

<asp:DropDownList
ID="ddlBrokers"
runat="server"
AutoPostBack="true"
DataSourceID="srcBrokers"
DataTextField="broker"
DataValueField="brokerId"
/>
<asp:ObjectDataSource
id="srcBrokers"
TypeName="DatabaseComponent.DBUtil"
SelectMethod="GetBrokers"
runat="server">
</asp:ObjectDataSource>

My DAL code:

public DataTable GetBrokers(bool? hasImport=null)
{
SqlCommand cmd = new SqlCommand("usp_GetBrokers");
if (hasImport.HasValue)
cmd.Parameters.AddWithValue("@hasImport", hasImport);
return FillDataTable(cmd, "brokers");
}

When the form loads I get this error:

ObjectDataSource 'srcBrokers' could not find a non-generic method 'GetBrokers' that has no parameters.

Is it my optional parameter that is causing the problem? How can I workaround this? Is it possible to have optional parameters with declarative ASP.NET code?

View 1 Replies

DataSource Controls :: BLL Add Method & ObjectDataSource?

Jan 4, 2011

My Business Logic Layer has AddItem method that add's to Items table in db along with an entry in Balance table.AddItem method uses two TableAdapters Items & Balance. Both these have corresponding Business Objects as Item and Balance.

Here is the AddItem method :

[Code]....

ASPX Page with DetailsView & ObjectDataSource

[Code]....

Now executing this page generates error as

ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'AddItem' that has parameters: _item, _balance, ItemName, GroupId, CategoryId, AuId, Rate, TotalStrScale, OffsStrScale, OffsAE [code]...

View 1 Replies

ObjectDataSource Does Not Call SelectCount Method?

Feb 22, 2010

I want to implement simple DataGrid and ObjectDataSource bundle with paging

my .aspx file

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

[Code]....

for some reason asp.net cals SelectMethod2 with (0,0,"") parameters and does not call GetCount.

View 1 Replies

C# - ListBox Is Null In Select Method Of ObjectDataSource?

Jan 14, 2010

I couldn't come up with a good subject. I have a simple ASP.NET 3.5 form. If you follow the numbered comments, I explain how I am stepping through the code when I run the page in debug mode. Both of the below functions are methods declared in the code behind file of the page, both are in the same _Default class. The ManagersListBox is declared in the Default.aspx page. Why is it that in the context of the GetSubordinates, the ManagersListBox is null? It's as if it disappears for a moment and then reappears after returning from the GetSubordinates method. Obviously the solution is to parameterize GetSuborindates, but that is not my concern. I am trying to learn how ASP.NET works and I would really like to understand why I am seeing this behavior "disappearing object".

[Code]....

View 1 Replies

C# - Error - Objectdatasource Could Not Find A Non-generic Method

Mar 7, 2011

I am binding dropdown list using Object data source. I got an error like this

"ObjectDataSource 'objDSStatus' could not find a non-generic method 'GetIssueAllowedStatusByCategoryIDStatusIDandUserType' that has parameters: IssueCategoryID."

My code is as follows .aspx

< asp:DropDownList ID="ddlStatus" runat="server" DataSourceID="objDSStatus"
DataTextField="IssueStatusName" DataValueField="IssueStatusID">
< /asp:DropDownList>
< asp:ObjectDataSource ID="objDSStatus" runat="server" TypeName="DA"></asp:ObjectDataSource>
.cs
private void Bind(int IssueCategoryID, int IssueStatusID, int UserType)
{
ddlStatus.Items.Clear();
objDSStatus.SelectMethod = "GetIssueAllowedStatusByCategoryIDStatusIDandUserType";
objDSStatus.SelectParameters.Clear();
objDSStatus.SelectParameters.Add("IssueCategoryID", IssueCategoryID.ToString());
objDSStatus.SelectParameters.Add("IssueStatusID", IssueStatusID.ToString());
objDSStatus.SelectParameters.Add("UserType", UserType.ToString());
objDSStatus.DataBind();
ddlStatus.DataBind();
}
DA.cs
public List<IssueStatus> GetIssueAllowedStatusByCategoryIDStatusIDandUserType(int IssueeCategoryID, int IssueStatusID, int UserType)
{
List<IssueStatus> issueStatusList = new List<IssueStatus>();
}

View 2 Replies

Accessing BLL With ObjectDataSource - Could Not Find A Non-generic Method?

Nov 25, 2010

I'm a starting C# programmer and I'm experiencing the following problem.I've created a dataset in Visual Studio With a table for persons making use of two table adapters, one for selecting all persons and one for selecting one person at a time filtered by the personID (Guid). This is a seperate project of my solution. After that I created a new project for the Business Logic Layer

private PersonenTableAdapter personenAdapter = null;
protected PersonenTableAdapter Adapter
{get....}
[System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, true)]
public DAL.Testdatabase.PersonenDataTable GetPersonen()
{...}
[System.ComponentModel.DataObjectMethodAttribute (System.ComponentModel.DataObjectMethodType.Select, false)]
public DAL.Testdatabase.PersonenDataTable GetPersonenByID(Guid ID)
{...}
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
public bool updatePersoon(string Voornaam, string Achternaam, string Geslacht, string Adres, string Huisnr, string Postcode, string Plaats, string Telnr, string GSM, string BSN, DateTime? CreateDate, string CreatedBy, DateTime? LastModifiedDate, string LastModifiedBy, bool? Actief, DateTime? DatumInactief, Guid ID)
{...}
When issueing the Update method using a detailsview with an Objectdatasource i get the following error.
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'updatePersoon' that has parameters: Voornaam, Achternaam, Geslacht, Adres, HuisNr, Postcode, Plaats, Telnr, GSM, BSN, CreateDate, CreatedBy, LastModifiedDate, LastModifiedBy, Actief, DatumInactief, original_ID.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved