DataSource Controls :: Complex ObjectDataSource And ASP?

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


Similar Messages:

Use ObjectDataSource With Complex Objects And FormView Control?

Dec 30, 2010

I have a complex object. For example a SCHOOL object that contains a collection of PERSON object. How can I use the ObjectDataSource control with a FormView and flatten the complex object? An example display would be to display the school name and comma separate the students on the page. Is this possible?

public string Id
{
get { return m_id; }

[code]...

View 1 Replies

SQL Reporting :: Mapping ObjectDataSource With Complex Data To ReportViewer And GridView?

Apr 1, 2010

I have a data object where one of the properties is a collection of another data object. I never really figured out how to map this to a GridView, but I came up with a workaround. Now I am stuck and cannot figure out any way to do this in a ReportViewer.

Here is how I solved the GridView issue:

Say we have these objects:

public class BoysWithToys : List<BoyWithToy>
{
}
public class BoyWithToy
{
string FirstName { get; set; }
string LastName { get; set; }
int BoyNumber { get; set; }
List<Toy> FavoriteToys { get; set; }
}
public class Toy
{
int BoyNumber { get; set; }
string Toy { get; set; }
}

What I wanted to do was to map BoysWithToys to the GridView and present one GridView row per BoyWithToy record. Where there was more than one FavoriteToys record I wanted to list them in a bulleted list in the FavoriteToys column. I accomplished this by calling RowDataBound() for the GridView, casting the e.Row.DataItem to BoyWithToy, then looping through all of the FavoriteToys and adding each Toy to a bulleted list, then setting the column's text to that list.

I have no idea how to accomplish anything similar in ReportViewer. If I simply drag the BoysWithToys DataSource to the designer and run it, the FavoriteToys column shows '#Error'.

View 3 Replies

DataSource Controls :: SQL Query With Complex Column?

Jun 14, 2010

I have following tables.

Items
ItemId
ItemName
GroupId
CatId
1
Apple
5
6
2
Banana
5
6
3
Blackberry
5
6
4
Grapes
5
6
5
Guavas
5
6
6
Beans fresh
5
7
7
Bitter Gourd
5
7
8................

View 7 Replies

DataSource Controls :: LINQ Mapping To Complex Business Objects?

Feb 5, 2010

I have two business objects mapped via LINQ to tables. One of the objects contains an instance of the other object and share a key as an identifier.I want to retrieve Class A and within class A all of Class B's values as well. What I am doing is this:

[Code]....

[Code]....

This seems a little clunky, as in slow. Is there a better way to get the Class B (User) information without making a query every time?

View 4 Replies

DataSource Controls :: Complex Paging Mechanism In Stored Procedure?

Jun 11, 2010

I want to have a paging mechanism. Its a bit hard to show all data and tables for this query but this is the current resulset.

As you can see Id has several duplicate entries (EventId as well but thats as its supposed to be):

Rownum EventID Id UserId

1 22 10 03088B17-36B2-425C-BD08-13E63AF07254
2 22 10 03088B17-36B2-425C-BD08-13E63AF07254
3 22 11 39E49E5A-7A42-43B6-882C-B22EE4C0922A
4 22 11 39E49E5A-7A42-43B6-882C-B22EE4C0922A
5 22 12 15C405BB-BD9A-4C6A-BF21-A95763FAD613
6 22 12 15C405BB-BD9A-4C6A-BF21-A95763FAD613
7 22 13 15C405BB-BD9A-4C6A-BF21-A95763FAD613
8 22 13 15C405BB-BD9A-4C6A-BF21-A95763FAD613
9 22 15 00000000-0000-0000-0000-000000000000
10 22 15 00000000-0000-0000-0000-000000000000

Now, I want to have paging and I'm doing that like this:

[code]...

In thew above query, when I leave out seltion of the RowNum column (so instead having: "SELECT distinct eventid,id,userid FROM") only 3 records are shown when I have a maximum pagesize of 5 passed to the @maximumRows variable.

What can I do to have exactly 5 records shown?

View 6 Replies

DataSource Controls :: Binding A Complex Query To A Data Control?

Apr 21, 2010

I'm trying to implement a recipe search page that allows users to specify search criteria by selecting checkboxes that match desired recipe attributes. All the data is stored in a database uing tables with 1 - many relationships. Each recipe can have multiple attributes from any of 5 attribute tables. I want to find all the recipes that match the user-selected criteria and display them in a grid. For example, the user may want a breakfast (attribute 1) recipe that is made with fruit and milk (attributes 2 and 3), is low-fat and high fiber (attributes 4 and 5), and takes less than 15 minutes to prepare (attribute 6). The query for this example might look something like:

SELECT distinct recipes.name, recipes.difficulty, recipes.preptime, recipes.cooktime

FROM recipes, recipeMeals, recipeDishes, recipeFoodGrps, recipeNutrients, recipeFixTimes

WHERE recipes.id = recipeMeals.recipeId and recipes.id = recipeDishes.recipeId and recipes.id = recipeFoodGrps.recipeId and recipes.id = recipeNutrients.recipeId and recipes.id = recipeFixTimes.recipeId and recipeMeals.mealId in (1) and
recipeDishes.dishId in (5) and recipeFoodGrps.fdGrpId in (1, 6) and recipeNutrients.nutrAttsId in (2, 3) and recipeFixTimes.fixTimeId in (1)

I' can generate the SQL but can't figure out how to bind it to a grid control. No could I see how to get any of the data controls to build the query for me. Is there a way to say "execute this query and display the results in a GridView"?

View 4 Replies

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

DataSource Controls :: Objectdatasource Does Not Run?

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

DataSource Controls :: Objectdatasource Does Not Bind The Name And ID?

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

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 :: ObjectDataSource With BLL Methods?

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

DataSource Controls :: Get Value Of Column In Objectdatasource?

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

DataSource Controls :: How To Configure Objectdatasource

Sep 9, 2010

created my own stored procedure in SQL Server for my aspnetdb database which is :

view plaincopy
to clipboardprint?

View 1 Replies

DataSource Controls :: ObjectDataSource With Datatable?

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

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 :: How To Get Total Count From An Objectdatasource

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

DataSource Controls :: Passing Parameters To ObjectDataSource

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

DataSource Controls :: Can Bind Textbox With ObjectDataSource

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

DataSource Controls :: Is It Possible To Bind DataTable To ObjectDataSource

Oct 31, 2010

is it possible to bind DataTable to ObjectDataSource?

View 4 Replies

DataSource Controls :: ObjectDataSource Binding To Querystring When Don't Want It To?

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

DataSource Controls :: ConflictDetection In ObjectDataSource Is Not Working?

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

DataSource Controls :: LocalResourceObject Null When Used By ObjectDataSource

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

DataSource Controls :: Getting The ID Of The Inserted Item Using ObjectDataSource?

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

DataSource Controls :: ObjectDataSource Update With Parameters?

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







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