DataSource Controls :: ObjectDatasource And Class As Datasource
Jun 24, 2010
I am really having a hard time trying to write something from scratch I created a 'Person' Class.Public Class Person
Private _FirstName As String = ""
Private _LastName As String = ""
Private _Age As Integer = 0
Public Sub New(ByVal FirstName As String, ByVal LastName As String, ByVal Age As Integer)
FirstName = FirstName
_LastName = LastName
_Age = Age
[code]...
View 1 Replies
Similar Messages:
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
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 26, 2010
I have set the objectdatasource in the web form. Does I need to check anything as I find that method "objProductSuppliment_Inserted" does not run??
-----------------------------------------------------------------------------------------------------------
<asp:ObjectDataSource ID="objProductSuppliment" runat="server"
OnInserted="objProductSuppliment_Inserted"
TypeName="BLL.WMS.ProductSuppliment"
[code]...
View 6 Replies
Jan 16, 2011
I've created a query in the table adapter for retrieving customer name based on the first letter. The query is executed fine, and the output is the customer name and ID. A Customer BLL accesses this query, and sends the results to an objectdatasource. This control is configured to use this customer-by-letter query. However for some reason, this objectdatasource does not bind the name and ID, but instead all the other fields produced by the main query in the table adapter (i.e. name, address, phone, etc....).
I'm probably not configuring something correctly, but I'm not sure what.
The BLL code:
[Code]....
The .net code:
[Code]....
View 4 Replies
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
Jun 22, 2010
I'm creating an ASP.net website with 3 layers (Presentation, BLL and DAL).
BLL and DAL are 'class library'. DAL has a typed dataset. Presentation refers BLL and BLL refers DAL.
I wanna populate my GridViews with ObjectDataSource, but it only shows me the DAL. Nothing from BLL...
What am I doing wrong?
View 2 Replies
Apr 17, 2010
Consider a fairly complex business object. For the sake of discussion, let's think about a "ClassRoom" object - that will have some attributes which occur once, such as "capacity" and "area". It will also have some repeating attributes - perhaps "desks" which will itself be a collection of desk objects. The desk object will in turn have attributes such as "width" and "height".My example is more complex, but that should show where I am coming from. The business object, as you would expect, exposes methods to get the attributes in and out. There is also logic included to perform the underlying database updates. Of course, the necessary business validation is also in there.
In terms of binding to the ASP page, I will need to bind the attributes of "ClassRoom" to a set of fields on the page (using one method on the object). I will also want to bind the desks collection to a Repeater or GridView (using another method on the object).Presumably, I need to find a way to use a single instance of the ObjectDataSource so that the updates to the two (or more) disparate sets of data can be kept in step. I suspect that if I simply put two data sources on the page, I will get two instances and therefore no correlation between them.This can't be a unique problem, but I'm struggling to find any useful information.
View 3 Replies
Jul 20, 2010
I was woundering if its possible for me to check for accesslevel value from the database using objectdatasouce.... From my coldfusion experience... i could just use an "if statement"
e.g: <cfif> (datasouce.column = x) then
<cfoutput> msg</cfoutput>
</cfif>
Am not so sure about .net.... All i am trying to do is to check for one value on the db and i dont mind puting it on code behind... i just need a way..
View 4 Replies
Sep 9, 2010
created my own stored procedure in SQL Server for my aspnetdb database which is :
view plaincopy
to clipboardprint?
View 1 Replies
Apr 14, 2010
Could I receive datatable or datarow as objectDataSource update function parameter? I need it because I need the datarow verison functionality to detect change for a column in the update function logic.this is what i had tried:
[Code]....
After I setup the update function in the ObjectDataSource , its DataObjectTypeName has a funny name
[Code]....
View 3 Replies
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
Mar 29, 2010
I have a gridview bounded to an objectdatasource.
I want to get total count of record when there is paging = true or false in gridview.
View 4 Replies
Aug 9, 2010
I followd Brian Orrell LINQ tutorial for paging/sorting and created a gridview bound to an ObjectDataSource through a method call which gets data from adatabase. My form includes two buttons with a textbox next to each one of them. I need to be able to populatte th egridview depending on the button that was pressed, I cannot figure out how signal my method which button was pressed.
[Code]....
[URL]
View 1 Replies
Mar 9, 2011
Is it possible for me to have an ObjectDataSource and the bind a texbox to a certain field to it?
View 2 Replies
Oct 31, 2010
is it possible to bind DataTable to ObjectDataSource?
View 4 Replies
Sep 23, 2010
I have an ODS control populating a Telerik grid. The ODS definition is pretty simple. It's set to call a method on a static class that has one parameter (entityID). I set this parameter in the OnSelecting event. When I test this, the world is a happy place and all is fine.
Then, I pass a query string to the page (which sets various unrelated values for the page, we'll say parameters X and Y). The page call's Telerik's radgrid.Rebind() event. When this happens, an error is throw from the ODS saying that the underlying method (the static data procedure) does not support parameters X and Y.
So, why is ODS thinking it should be using any querystring values at all when I have explicitly set the entityID parameter (of type Asp:Parameter)? How do I stop this from happening?
The Html:
[Code]....
The OnSelecting:
[Code]....
I see this odsList_OnSelecting being hit and the inspection of e.InputParameters only contains my expected single entry.
View 4 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
Feb 5, 2010
I have a dropdown list that uses an ObjectDataSource. The select method of the ObjectDataSource needs to localize the TextField, so i create a Dictionary<int, string> and use GetLocalResourceObject as such:
[Code]....
In the Local Resource file, there is status0, status1, and status2, all with a value (Deleted, Active, Inactive). The dropdown and object datasource like:
[Code]....
Now, if I use an ObjectDataSource and put the DropDownList's DataSourceID to it, I will get a null reference on the lookup to the GetLocalResourceObject. BUT If I manually set DataSource/DataBind on the dropdown list on Page_Load, it works fine:
[Code]...
OR If I move the status values to a global resource file and use GetGlobalResource instead of GetLocal, it works fine! Why can I not use an ObjectDataSource and LocalResourceObject in this way?
View 1 Replies
Aug 4, 2010
Im using Objectivation as a DAL with GridView !
I would like to link item when i create it with the InsertMethode :
I have this 2 table :
Item ( id, name )
ItemRelation( idrelation, idParentItem, idSonItem)
I have a page with a gridview with the liste of item in relation with another item (Same table) : Select * From Item where id IN ( Select idSonItem where idParentItem = @TheItem )
When i add an item from this grid i would like to link it with the current Item : So I insert the Item with the GridView InsertMethod then I do another Query an the ItemRelation with idParentItem as the courant Item and the Inserted Item as the idSonsItem !
so the question is : How to get the id of an inserted Item after i get executed the InsertMethod ?
View 4 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
Oct 10, 2010
I have an ObjectDataSource and I want to configure it from code behind , I want to set the InsertMethod , Selectmethod from Code Behind and set it to my Business Layer files
View 1 Replies
Mar 20, 2011
I'm having trouble, I have a component called Search that has a SearchCars method I use both in the objectdatasource control like this:
<asp:objectdatasource
selectMethod="SearchCars"
typename="Search"
my question is what type of object should I return from the SearchCars method?
the method seginature accepts a business entity object "Car"
like that
public ????? SearchCars(Car car)
View 3 Replies
Apr 14, 2010
Could you teach me how to make girdview pass my object (with all it properties) to my ObjectDataSource delete method please?So far the object received by the delete method has only the datakey value, other properties are null.From this article indicates that this is default behaviour - ttp://www.manuelabadia.com/blog/PermaLink,guid,c72852ae-1fdd-4934-a715-f565ceaf21cc.aspxBut i need the other properties pass to the delete method too so i can do other thing before I actually delete the record.
View 3 Replies
Oct 23, 2010
I have objectDataSource connected to report viewer.
This datasource have a select method to filter the results by Dep_id parameter
Now if i want to include all results(All Departments) what should i do ???
View 5 Replies