DataSource Controls :: How Use The Select Method To Get The Rowcount With Objectdatasource

Mar 22, 2010

i have this class

class MyDal
{
IList<MyData> GetAll(string orderBy, , int count, int firstIndex, out int totalRowCount);
}

i'm using an objectdatasource with MyDal to bind values to a gridview.

i want know if there's a way to configure the objectdatasource to use the parameter totalRowCount without calling the SelectCountMethod.

View 3 Replies


Similar Messages:

DataSource Controls :: Objectdatasource With A Generic Select Method - How To Pass The Type

Mar 14, 2011

[Code]....

[Code]....

The GetList method is as folllowing:

[Code]....

Now i can populate my gridview trough code by this: //gvwDiensten.DataSource = new BindingList<diensten>(dataManager.GetList<diensten>().ToList());But i would like to use an objectdatasource, so i created this:

[Code]....

</asp:ObjectDataSource>

But when running the page i get:

ObjectDataSource 'dsDiensten' could not find a non-generic method 'GetList' that has no parameters.

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

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

DataSource Controls :: Custom Insert Method In ObjectDataSource?

Jan 19, 2010

I've an ObjectDataSource & its datasource from typed dataset which is bind to 3 textboxes.

One of that textbox text concatenate with other two textboxes values.

Some thing like this,

textbox1.text=textbox2.text & textbox3.text

How can I customize my insert query for this?

I could not see the insert query in my objectdatasource.

View 4 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 :: Getting Returnvalue From Objectdatasource Delete Method?

Jul 13, 2010

How and where can I get the returnvalue from my "DeleteGuestById" method to show the right error message to my user?

I have this:

Protected Sub gvGuestlist_OnRowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gvGuestlist.RowCommand
If e.CommandName = "DeleteGuest" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim data As DataKey = gvGuestlist.DataKeys(index)
Dim GuestId As Integer = data.Values("id")
odsGuestlist.DeleteParameters.Clear()
odsGuestlist.DeleteParameters.Add("id", GuestId)
odsGuestlist.Delete()
End If
End Sub

In my BLL:

<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, False)> Public Function DeleteGuestById(ByVal ID As Integer) As Integer
Dim returnval As Integer
GuestlistAdapter.DeleteGuestById(ID, returnval)
Return returnval
End Function

I think I have to be in the ObjectDatasources' "OnDeleted" method but I have no what code to place there.

View 2 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

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

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 :: Programmatically Setting ODS Select Method And Select Parameters?

Dec 22, 2010

The drop down list is used to determine what search criteria will be used to find an invoice. I tried to set the Select method in the switch statement. I don't understand how to set the Select Method and the select parameters programmatically though . I tried a few different ways but can't make the compiler happy. My ODS is in scope in the code behind. I'm not able to access it's properties though. The BAL resides in a separate project that is a ClassLibrary. I also have a using statement for the ClassLibrary project in the code behind.

give me an example of how to do this?

Mark up:

[Code]....

[Code]....

[Code]....

[Code]....

View 1 Replies

DataSource Controls :: Select / Returns Error No Overloading Method For Select?

May 9, 2010

protected void Button19_Click(object sender, EventArgs e)
{
SqlDataSource conn = new SqlDataSource();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["Database2ConnectionString1"].ToString();
conn.SelectCommandType = SqlDataSourceCommandType.Text;
conn.SelectCommand = "SELECT FROM table1 (a, b)VALUES(@a,@b)";
conn.SelectParameters.Add("a",TextBox1.Text);
conn.SelectParameters.Add("b", TextBox2.Text);
int rowsAffected = 0;
try
{
rowsAffected = conn.Selectt();
}
catch (Exception)
{
Label1.Text = "Error";
}
finally {
conn = null;
}
if (rowsAffected != 0)
{
Label1.Text = "Data saved";
}
}

well it returns error no overloading method for select (P.S. same code work fine for insert)

View 5 Replies

VS 2005 Select Method In Objectdatasource Showing Last Value Repeatedly

Jan 4, 2010

I have to display the contacts in gridview.I'm using objectdatasource. I have given the select method of objdatasource below:

Code:

Imports Microsoft.VisualBasic
Imports system.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Generic
Public Class Contactmanager
Dim conn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("localConnectionString").ToString)......

View 5 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

DataSource Controls :: Configuring ObjectDataSource Not Giving Option To Select Correct TableAdapter

Sep 16, 2010

So, I have 3 table adapters in my dataset, and trying to configure the objectDataSource will not give me the option to select the correct table adapter.

I set up a temporary website to illustrate what I am talking about, along with pics, not much, just 4 pics.

https://sites.google.com/site/configuringobjectdatasource/

The first 2 pics are irrelevant but just in case anyone thinking I don't have it set up properly. The other table adapters are working fine, which I have gridviews being populated etc.

why it will not give me the option to select aspnet_GetRecordDatesTableAdapter?

View 9 Replies

DataSource Controls :: ObjectDataSource / An Insert,select,Delete And Update Methods Being Referenced?

Jan 31, 2011

I am using an objectDataSource for the first time. My objectDatasource looks like this:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="CustomerData"
DataObjectTypeName="Customer" DeleteMethod="DeleteCustomer" InsertMethod="InsertCustomer"
SelectMethod="GetCustomersByObject" UpdateMethod="UpdateCustomer" OldValuesParameterFormatString="original_

[code]...

View 1 Replies

ObjectDataSource Databinding: Getting Object Properties By Select Method Call - How To Access Value

Feb 22, 2010

I am using an ObjectDataSource control to call a MapInfo object. This object has two properties:

public IList Visits
public int TotalAvailable

The select method returns an IList but the TotalAvailable property is also populated. I have set the TypeName in the ObjectDataSource to the MapInfo object but because the Select method only returns the IList I don't have access to the TotalAvailable.

[code]....

Is there any way to access this value. I know it is being populated in the MapInfo object but all that gets returned from the Select method is the IList

View 2 Replies

DataSource Controls :: How To Format The Date To Uk Format With The Select Statement Through Objectdatasource

Jun 23, 2010

I have a objectdatasource control with a field of date and time and I was wanting to know how you format the date to uk format with the select statement through my objectdatasource. And what type of integer is bigint in SQL?

View 3 Replies

DataSource Controls :: Selecting Columns From A Datatable Using Select Method?

May 7, 2010

I would like to select some columns from a Datatable, I mean, something like Select Name, Surname, ID,

I'm trying to do something like this:

DataTable dtExcel = new DataTable();
DataRow[] buena = dtExcel.Select("NAME");

in order to get only a view or table with one column (NAME).

View 1 Replies

DataSource Controls :: Possible Memory Leak In DataTable.Select Method?

Jun 18, 2010

I have an application which was recently ported from Classic ASP to .NET 3.5. I'm pulling some data from a stored procedure and once retrieved, I'm doing using the Select method on the DataTable in a loop so I don't have to keep going back to the database.It appears that there's something wrong here as I can refresh the page repeatedly and see the memory usage increase by a few megabytes, up to the point where we get an error. If we recycle the app pool in IIS, it starts working again, for a little while.

Is there a memory leak in this method? I did some research on the subject and Microsoft said there was an issue like that in .NET 1.0 and 1.1, but I'm using a higher version.Or, is this something else, such as not managing resources correctly? Here's a snipped of my code:

[Code]....

Initially, this app was using XML instead of a datatable and using XPATH to query the data, but it was too slow. I thought using a dataset with DataTable selects was a better option, but now we found this issue. I was thinking since the loop executes several hundred times that getting all the data and filtering through it on the client was a better choice instead of calling several web methods to get the subsets of data.

View 5 Replies

DataSource Controls :: Implementing A BLL / Contacts Table, The Select Method Is A Sql Query Against A Sql Server 2000 Database?

Feb 17, 2010

I'm implementing a BLL layer and have a few questions. First, in my DAL, there is a contacts table, the select method is a sql query against a sql server 2000 database. The preview data returns everyting as expected. The query is

[Code]....

The BLL method is built like so

[Code]....

When using the BLL method to a gridview, the results of the subquery are not displayed. There are also other methods, each having a different where clause for ContactRole_ID and each is having the same issue of not displaying the subquery reult in the gridview. No error, but no data is displayed for the subquery either. Here is the templatefield of the gridview

[Code]....

Another item that is causing an error is in trying to update a record. Here is the DAL update method

[Code]....

And the BLL update method

[Code]....

The error says i have extra parameters, but have no clue where the extra parameters are being picked up. The error isObjectDataSource 'odsContacts' could not find a non-generic method 'UpdateContact' that has parameters: _ContactID, _Active, _ContactName, _Office, _VirtualOffice, _Pager, _Fax, _Home, _Cellular, _Email, _ContactRole_ID, Active, ContactRole_ID, ContactName, Office, Email, VirtualOffice, Pager, FAX, Home, Cellular.And the objectdatasource

[Code]....

View 4 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

Forms Data Controls :: ObjectDataSource's Select Parameters?

Feb 28, 2010

I have a DetailsView control with a SelectMethod and two select parameters wich one of the parameters is a control parameter, The parameters are not passed to objectDatasource's select method, the objectdatasource has been defined as follows:

<asp:ObjectDataSource ID="objCurrCompetitor" runat="server" SelectMethod="GetCompetitorByUserAndCompetition"
DeleteMethod="DeleteCompetitor"
TypeName="MZ.Competitions.BLL.Main.Competitor"

[code]...

View 2 Replies

Forms Data Controls :: How To Get Value To The Objectdatasource From Datalist Itembound Method

Dec 21, 2010

how to get value to the objectdatasource from datalist itembound method

protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)

View 4 Replies







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