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


Similar Messages:

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 :: 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 :: 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 :: 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

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

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

ObjectDataSource 'ObjectDataSource1' Could Not Find A Non-generic Method MethodName?

Feb 3, 2010

I am getting error : ObjectDataSource 'ObjectDataSource1' could not find a non-generic method What would be the possible cause / solution for this error.This error is coming when call below method ObjectDataSource1.SelectMethod = "MethodName"// thr r some more code after that, although not much irrelevant
en call Server.Transfer("NewPage.aspx", True);

View 2 Replies

Custom Server Controls :: Using The Generic Type 'System.Collections.Generic.IEnumerable' Requires '1' Type Arguments

Nov 25, 2010

I'm trying to create a control out of a class I found, and one of the overridden functions is the following:

protected override void PerformDataBinding(IEnumerable data)

However, when I try to build the control I'm getting the error as shown in the subject. I've tried searching, and it seems the signature for the original function matches the one I have, and all other solutions I've seen uses the same signature.

View 3 Replies

C# -pass A Generic Type With The User Control?

Aug 19, 2010

In Asp.net Web forms why must a user control be partial? I tried to remove the partial keyword and it says: Missing partial modifier on declaration of type 'test'; another partial declaration of this type exists
Where is the other declaration?I am trying to pass a generic type with the user control how can I do that? I can't unless I change the other declaration too. I couldn't find it so I removed the partial keyword.Note:
you do have 3 files if your making WebApplication but if your making website you only get 2 files?
UserControl.ascx
UserControl.ascx.cs
so in website where is the other declaration?the reason i want generic is because im making a Grid User Control so i want to pass the type the datasource is going to have.

View 4 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 :: How To Pass Variable To ObjectDataSource

Sep 10, 2010

I have an objectDataSource which uses my stored procedure GetNotifications

And my GridView is bound to that objectDataSource

the only problem is that my stored procedure requires the variable @UserName and then returns the values for that username, but I do not know how to pass the variable to the objectDataSource, does anyone know the code for this?

I can get userName from HttpContext.Current.User.Identity.Name but how do I pass that to the objectDataSource?

View 7 Replies

DataSource Controls :: Pass Object As SessionParameter In ObjectDataSource?

Dec 28, 2010

Is it possible to pass a domain object as session parameter in an ObjectDataSource. I'm doing this:

<asp:ObjectDataSource ID="ParticipantsDataSource" runat="server" OnInit="SqlDataSource_Load"
SelectMethod="LoadParticipants" TypeName="SB.Web.units.Players">
<SelectParameters>
<asp:SessionParameter Name="user" SessionField="User" Type="SB.BusinessLogic.DomainEntity.User" />
</SelectParameters>
</asp:ObjectDataSource>

But I get the error message that I can't create an object of the type System.TypeCode from the string containing SB.BusinessLogic.DomainEntity.User for the property Type.

View 1 Replies

DataSource Controls :: Pass Id To ObjectDataSource From DetailsView Control?

Oct 25, 2010

I have an objectDataSource to retrieve data and fill a listBox on edit

I created a BLL method to get the data and set the controlId to the detailsVeiw control but the id is not passed throuh to the bll class

this is my code:

[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

DataSource Controls :: The Type Specified In The TypeName Property Of ObjectDataSource Not Found

Jun 26, 2010

I am using Visual Studio 2010 for the first time. I program in MS Access for a long time at decide to move to the ASP world. My problem is that I design my first web .aspx default page with a simple data grid. I decided to connect the data via the business object data adapter. I use the Dataset designer to great the dataset. All looks well and works fine on my PC. But when moved to the server I get the Terror "The type specified in the TypeName property of ObjectDataSource not found".

From my reading for the past two days, it seems that something need to be define (a class of some sort) to let ASP know where to find the data adapter. If this is the case, then why did not Visual Studio 2010 did not automatically build the class in the appropriate BIN/ APP_CODE or Global directory and more importantly, why would it work fine on the PC , but not on the server. I am totally blind-sided by Visual Studio 2010 allowing me to design and test on PC but throws me a curl ball with moving to a server. Am I assuming to much from Visual Studio 2010???

What is the solution.. What I am looking for is to know where exactly where and how to write this class. I am so new to ASP, all of my reading just confusing me more and more by reading so many post on this error. I know it is probably a simple class to write somewhere, but why did not Visual Studio 2010 write it accordingly.

View 1 Replies

DataSource Controls :: How To Pass An Object To The Selectmethod Of The Objectdatasource Control

Mar 31, 2011

how to pass an object to the selectmethod of the objectdatasource control?

View 2 Replies

Using Custom Class With Method That Takes Generic Type Parameter

Apr 23, 2010

I have several custom classes that derive from a common base class so they share several members in common. I would like to be able to pass objecs from any of these three classes to a function that will "look at" common properties. However, it seems there is a catch 22 -- When I try to access a member (.FirstName) of the passed object, the computer reports an error that it thinks the member doesn't exist.

It seems to be a sort of contradiction -- since I didn't declare the type, the computer can't confirm existence, but it seems that it should have to take it on faith since the generic character of the type is specified by the code. Possibly there is something I don't know about that would fix this. I'm showing VB code for what I have so far. I went ahead and hardcoded an instance to confirm that the object exists and has the needed property. I commented out the line that had the code that resulted in the computer reporting an error.

[Code]....

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

Generic Parameter - Pass Another Control Type And Execute Exact Same Logic

Nov 30, 2010

I have a class constructor which accepts a Listbox.

[Code]....

I need to be able to pass another control type and execute the exact same logic in one of the methods... Seems like a use for Generics... I'm not so sure about the syntax... The type of control that I will pass is a rad combo box which has many of the same properties of the listBox control. However, RadComboBox does not inherit from listBox or dropDown so I am unable to cast. When changing the signature of the constructor to As RadComboBox as well as the property and field the method works as expected. I am trying to avoid duplicating code here.

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







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