473,796 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2-Way Databinding without the DataSources from 2.0

L.S.,

Hello is there a way to implement 2-way databinding without using the
datasources from dotnet 2.0. Why would you ask? Now that's simple.

I've created an object model with BusinessObjects and I don't want to write
an separate provider layer for the datasources. This is because I loose all
the benefits of my objectmodel.

Are there other developers who think this way?

Thanx in advance.

Greetz,
Jan 24 '06 #1
8 1833
When I was programming in ASP.NET 1.1, I implemented 2-way data binding using
my own custom data bound tem plated control (or creating a composite control
out of the repeater). This allowed me to use templates against a BLL. In
ASP.NET 2.0 I found, so far, the objectdatasourc e to be a very helpful for
RAD. I think it is a great improvement.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Joey Chömpff" wrote:
L.S.,

Hello is there a way to implement 2-way databinding without using the
datasources from dotnet 2.0. Why would you ask? Now that's simple.

I've created an object model with BusinessObjects and I don't want to write
an separate provider layer for the datasources. This is because I loose all
the benefits of my objectmodel.

Are there other developers who think this way?

Thanx in advance.

Greetz,

Jan 24 '06 #2
Yeah I did something like that in asp.net 1.1. But I'm not happy with the
design
of Microsoft about the ObjectDataSourc e, because if you use an genuine
objectmodel u can't use the ObjectDataSourc e for Updating/Deleting/Inserting
you can only use Select.

If you realy want to use the objectdatasourc e you'lle have to write an
CRUD-layer who is very close of the UI (in my meaning design fault),
this layer must implement some CRUD methods. These CRUD-methods can use your
normal businesslayer.

I had hoped Microsoft created an independent layer for binding
objects/datasets to controls (ASP.NET or WinForms), now I will have to write
all those things myself.

By the way I'm interested in your "own custom data bound tem plated control
", because my own controls where not 2 way.

Greetz,

"Phillip Williams" wrote:
When I was programming in ASP.NET 1.1, I implemented 2-way data binding using
my own custom data bound tem plated control (or creating a composite control
out of the repeater). This allowed me to use templates against a BLL. In
ASP.NET 2.0 I found, so far, the objectdatasourc e to be a very helpful for
RAD. I think it is a great improvement.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Joey Chömpff" wrote:
L.S.,

Hello is there a way to implement 2-way databinding without using the
datasources from dotnet 2.0. Why would you ask? Now that's simple.

I've created an object model with BusinessObjects and I don't want to write
an separate provider layer for the datasources. This is because I loose all
the benefits of my objectmodel.

Are there other developers who think this way?

Thanx in advance.

Greetz,

Jan 24 '06 #3
Hi Joey,

I am not sure why you say that you “can't use the ObjectDataSourc e for
Updating/Deleting/Inserting” and that “you can only use Select.” The demos
on my website www.webswapp.com update the records using an objectDataSourc e
that updates the data through a BLL. You can use a BLL class by specifying a
value for the DataObjectTypeN ame.

For example in this demo
http://www.webswapp.com/CodeSamples/...idView_2c.aspx I pass to the
update method a customized class and defines parameters that the
objectDataSourc e would set within that class.

As for my custom dataBound Templated Control that I referred to in the
previous message, if you are interested in creating one you might:

1- read this article for Scott Mitchell on creating databound templated
controls:
http://msdn.microsoft.com/library/de...edcontrols.asp

2- Create your own templates (as the sample in step 1 demonstrated)

3- For controls, such as textboxes, that are not databound by default, add a
step that is not in Scott’s demo where you create your own custom controls of
the existing server controls:
a. Persist the content in the ViewState upon setting a property of
the control
b. Handle the MyBase.DataBind ing event to bind the content to the
control then
c. Handle other events upon change of data inside the server
control, for example,
i. MyBase.TextChan ged event for the TextBox server control:
during this step you would call a method that would update the data within
the class associated with this control

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Joey Chömpff" wrote:
Yeah I did something like that in asp.net 1.1. But I'm not happy with the
design
of Microsoft about the ObjectDataSourc e, because if you use an genuine
objectmodel u can't use the ObjectDataSourc e for Updating/Deleting/Inserting
you can only use Select.

If you realy want to use the objectdatasourc e you'lle have to write an
CRUD-layer who is very close of the UI (in my meaning design fault),
this layer must implement some CRUD methods. These CRUD-methods can use your
normal businesslayer.

I had hoped Microsoft created an independent layer for binding
objects/datasets to controls (ASP.NET or WinForms), now I will have to write
all those things myself.

By the way I'm interested in your "own custom data bound tem plated control
", because my own controls where not 2 way.

Greetz,

"Phillip Williams" wrote:
When I was programming in ASP.NET 1.1, I implemented 2-way data binding using
my own custom data bound tem plated control (or creating a composite control
out of the repeater). This allowed me to use templates against a BLL. In
ASP.NET 2.0 I found, so far, the objectdatasourc e to be a very helpful for
RAD. I think it is a great improvement.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Joey Chömpff" wrote:
L.S.,

Hello is there a way to implement 2-way databinding without using the
datasources from dotnet 2.0. Why would you ask? Now that's simple.

I've created an object model with BusinessObjects and I don't want to write
an separate provider layer for the datasources. This is because I loose all
the benefits of my objectmodel.

Are there other developers who think this way?

Thanx in advance.

Greetz,

Jan 24 '06 #4
Phillip,

First of all thanks for your anwser. When I create business-objectmodel I
make something like this:

public class Address
{
public Address(int id) { Dal.Get() }

public bool Delete() { Dal.Delete() }

public bool Save() { Dal.Save() }

public static GetAllAddresses () { Dal.GetAllAddre sses() }

private int _id = int.MinValue;
public int Id { get { return _id } }

...some other properties and methods...
}

If you do it like this way, and this is a normal businessobjectm odel,
you can't use this class in the ObjectDataSourc e, you'll have to write
an descendant or create an provider who gets ands sets businessobjects
for u. Something like:

public class AddressProvider
{
public static bool Update(int id, string city, etc)
{
Address a = new Address(id);
a.City = city;
return a.Save();
}

... etc .....
}

I'm convinced that this isn't the right way to do it, but if it can't be done
I will have to work with it.

I hope you understand me now ;-)

Greetz,

Joey Chömpff
Jan 24 '06 #5
Hi Joey,

Actually, your class would work just fine if you were to make one simple
modification: namely a default constructor. Note that you need “set”
statements for the properties whose values are to be updated by parameters
collection of the objectDatasourc e. For example your class can look like
this:

public class Address
{

public Address(){
//this default constructor is essential for the
objectdatasourc e //
}

// the rest of your class as is; only make sure you have set statements
// for the properties that the ObjectDataSourc e would pass from the
// UpdateParameter s collection
}

You can look at the demos on my website for a proof of this concept.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Joey Chömpff" wrote:
Phillip,

First of all thanks for your anwser. When I create business-objectmodel I
make something like this:

public class Address
{
public Address(int id) { Dal.Get() }

public bool Delete() { Dal.Delete() }

public bool Save() { Dal.Save() }

public static GetAllAddresses () { Dal.GetAllAddre sses() }

private int _id = int.MinValue;
public int Id { get { return _id } }

...some other properties and methods...
}

If you do it like this way, and this is a normal businessobjectm odel,
you can't use this class in the ObjectDataSourc e, you'll have to write
an descendant or create an provider who gets ands sets businessobjects
for u. Something like:

public class AddressProvider
{
public static bool Update(int id, string city, etc)
{
Address a = new Address(id);
a.City = city;
return a.Save();
}

... etc .....
}

I'm convinced that this isn't the right way to do it, but if it can't be done
I will have to work with it.

I hope you understand me now ;-)

Greetz,

Joey Chömpff

Jan 24 '06 #6
Phillip,

I can live with an default constructor, but how do you handle
readonly fields like Id's, etc. These fields are set by the dal or
the businessobject itself and cannot be modified from outside.

Could u give me an working example of your BusinessLayer?

Greetz,

Joey Chömpff
Jan 24 '06 #7
Ok… I see what you mean… you are right… in your scenario; you will have to
write a descendant class or a provider to be able to utilize your classes in
the ObjectDataSourc e server control.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Joey Chömpff" wrote:
Phillip,

I can live with an default constructor, but how do you handle
readonly fields like Id's, etc. These fields are set by the dal or
the businessobject itself and cannot be modified from outside.

Could u give me an working example of your BusinessLayer?

Greetz,

Joey Chömpff

Jan 24 '06 #8
Phillip,

Thanx for thinking with me,

I've have an solution but it isn't a perfect one.
I have made partial classes of my businessobjects and newed the properties
who are readonly. Then i made an Update, Delete and Insert methods on the
partial classes who accepts a parameter of the partial class.

I hope that MS creates an independent layer for databinding in the near
future.

Greetz,

Joey Chömpff
Jan 24 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1689
by: Mr Newbie | last post by:
Ive got the basic idea behind DataBinding Expressions, but I have a couple of questions, Ok its four actually :) Q1.) It would appear that if you use Page.DataBind that all child controls and the page get bound to their respective DataSources, is this correct ? and if so why would you need to individually bind controls, why not jsut use Page.DataBind everytime?, Im sure there is a good reason why not but I cant think of one at the...
4
2204
by: pmcguire | last post by:
Can someone explain to me the difference between these two bindings? dim b as Binding b=New Binding(dsMyDataset.tblMyTable, "colMyColumn") b=New Binding(dsMyDataset, "tblMyTable.colMyColumn") They produce different behavior in my application. I know which one I must use, but I don't understand why.
8
2186
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got answered... In 1.1 we always did our own myDataAdapter.fills and we liked that control for lots of good reasons. Now the new DataSource (or is it a TableAdapter:Dataset) automatically fills the Gridview. How can we control that fill? In a...
5
12532
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I update the datasource - awesome, but I have an issue with updating from a different thread. Here is my datasource, a person class that raises the PropertyChanged event: class Person : INotifyPropertyChanged {
0
1180
by: Owen Richardson | last post by:
I have a page that displays a news article in a form view feeding off a datasource that just picks up the id from a query string. I want to add functionality for related links - so i created a stored procedure that takes three parameters. On the page i have added a second datasource which calls my stored proc, and spits out the results into a Repeater. Currently however the two datasources are independant - my second data source takes 3...
19
3162
by: cpnet | last post by:
I'm using VS2005, C#, ASP.NET 2.0. I'm trying to create a report using SQL Reporting Services (to be used in local mode so I don't have to deal with SQL Server). When I create a new report in my website, nothing shows up in the Website Data Sources window. I added a few different strongly-typed Datasets to my website, and they don't show up. The only way I could get anything to show up was to create a new class that's derived from a...
4
2014
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys Just a general query regarding using the AccessDataSource within a website which uses a MasterPage. The layout of my content page is as follows... <asp:Content ID="Content1" ContentPlaceHolderID="cphContent" Runat="Server"> <h1><asp:Label runat="server" Text='<%# Eval("StoryTitle") %>" ID="lblHeading" />
3
1988
by: Martin Frey | last post by:
Hello guys, im new to asp.net and im trying to get me used to it. I've managed to create webpages with detailviews, databinding and datasources. Adding or inserting data went very well and, after a while, very fast. Now i ran into a problem with accessing the data. I need to send an email to the administrator with the data the user has selected instead of calling the update method. Everything i've build up via the designer or the...
1
1689
by: Wingot | last post by:
Hey, I have an application codenamed WingFlex. It has a number of aspects to it, but the prudent parts for this problem are all within the "Client" Schema. The Client schema has three tables in it, on named Country, one named MedicalCondition, and one named Customer. The Customer database has five foreign keys in it, one to Country, one to MedicalCondition, and three as self referential keys to Customer (BillTo, for where the
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10173
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10006
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.