473,587 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataBinding a single record

Hi all

When I bind to multiple records I use a DataList. This allows the
web-designer to add code like <%#DataBinder.E val(Container.D ataItem,
"Name")%>

Whenever I want to retrieve a single record from the DB for editing I also
want to allow the designer to use the same technique. At the moment I am
still using a DataList for the single row, but this seems like the wrong
thing to do. How should I be doing it?
--
Pete
=============
http://www.DroopyEyes.com - Delphi source code
Audio compression components, Fast Strings, DIB Controls

Read or write article on just about anything
http://www.HowToDoThings.com

Nov 18 '05 #1
3 2265
Pete

Databinding one record to DataList is still fine, especially when you want
to take advantage of its editing capabilities. Its data source enumerator
will enumerate its internal templated control just once. You still have
options, though. For example when you wanted to databind one record to let's
say Label control you could use:

<%# DataBinder.Eval (yourDataSet, "YourTable. Rows[0].YourColumn" %>

or using default DataView:

<%# DataBinder.Eval (yourDataSet,
"Tables[YourTable].DefaultView.[0].YourColumn" %>

You could use same technique to data bind to TextBox and allow editing by
updating yourDataSet.Tab les["YourTable"].Rows[0]["YourColumn "] value with
your data adapter.

Different approach would be to construct business model (components) so you
could bind its exposed public properties even directly:

<%# MyComponent.MyP roperty %>

HTH

Radek

"Peter Morris [Droopy Eyes Software]" <support@_nospa m_.com> wrote in
message news:e2******** ******@TK2MSFTN GP12.phx.gbl...
Hi all

When I bind to multiple records I use a DataList. This allows the
web-designer to add code like <%#DataBinder.E val(Container.D ataItem,
"Name")%>

Whenever I want to retrieve a single record from the DB for editing I also
want to allow the designer to use the same technique. At the moment I am
still using a DataList for the single row, but this seems like the wrong
thing to do. How should I be doing it?
--
Pete
=============
http://www.DroopyEyes.com - Delphi source code
Audio compression components, Fast Strings, DIB Controls

Read or write article on just about anything
http://www.HowToDoThings.com

Nov 18 '05 #2
Thanks :-)

"RadekP" <ra***@aldec.co m> wrote in message
news:O3******** ******@tk2msftn gp13.phx.gbl...
Pete

Databinding one record to DataList is still fine, especially when you want
to take advantage of its editing capabilities. Its data source enumerator
will enumerate its internal templated control just once. You still have
options, though. For example when you wanted to databind one record to let's say Label control you could use:

<%# DataBinder.Eval (yourDataSet, "YourTable. Rows[0].YourColumn" %>

or using default DataView:

<%# DataBinder.Eval (yourDataSet,
"Tables[YourTable].DefaultView.[0].YourColumn" %>

You could use same technique to data bind to TextBox and allow editing by
updating yourDataSet.Tab les["YourTable"].Rows[0]["YourColumn "] value with
your data adapter.

Different approach would be to construct business model (components) so you could bind its exposed public properties even directly:

<%# MyComponent.MyP roperty %>

HTH

Radek

"Peter Morris [Droopy Eyes Software]" <support@_nospa m_.com> wrote in
message news:e2******** ******@TK2MSFTN GP12.phx.gbl...
Hi all

When I bind to multiple records I use a DataList. This allows the
web-designer to add code like <%#DataBinder.E val(Container.D ataItem,
"Name")%>

Whenever I want to retrieve a single record from the DB for editing I also want to allow the designer to use the same technique. At the moment I am still using a DataList for the single row, but this seems like the wrong
thing to do. How should I be doing it?
--
Pete
=============
http://www.DroopyEyes.com - Delphi source code
Audio compression components, Fast Strings, DIB Controls

Read or write article on just about anything
http://www.HowToDoThings.com


Nov 18 '05 #3
FYI .. The new upcoming edition of ASP.NET 2.0 ("Whidbey") does have a
special, neat control for databinding one record with full editing/inserting
capability - "DetailsVie w" ..

Radek

"Peter Morris [Droopy Eyes Software]" <support@_nospa m_.com> wrote in
message news:ui******** ******@TK2MSFTN GP12.phx.gbl...
Thanks :-)

"RadekP" <ra***@aldec.co m> wrote in message
news:O3******** ******@tk2msftn gp13.phx.gbl...
Pete

Databinding one record to DataList is still fine, especially when you want
to take advantage of its editing capabilities. Its data source enumerator will enumerate its internal templated control just once. You still have
options, though. For example when you wanted to databind one record to

let's
say Label control you could use:

<%# DataBinder.Eval (yourDataSet, "YourTable. Rows[0].YourColumn" %>

or using default DataView:

<%# DataBinder.Eval (yourDataSet,
"Tables[YourTable].DefaultView.[0].YourColumn" %>

You could use same technique to data bind to TextBox and allow editing by updating yourDataSet.Tab les["YourTable"].Rows[0]["YourColumn "] value with your data adapter.

Different approach would be to construct business model (components) so

you
could bind its exposed public properties even directly:

<%# MyComponent.MyP roperty %>

HTH

Radek

"Peter Morris [Droopy Eyes Software]" <support@_nospa m_.com> wrote in
message news:e2******** ******@TK2MSFTN GP12.phx.gbl...
Hi all

When I bind to multiple records I use a DataList. This allows the
web-designer to add code like <%#DataBinder.E val(Container.D ataItem,
"Name")%>

Whenever I want to retrieve a single record from the DB for editing I

also want to allow the designer to use the same technique. At the moment I am still using a DataList for the single row, but this seems like the wrong thing to do. How should I be doing it?
--
Pete
=============
http://www.DroopyEyes.com - Delphi source code
Audio compression components, Fast Strings, DIB Controls

Read or write article on just about anything
http://www.HowToDoThings.com



Nov 18 '05 #4

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

Similar topics

1
2363
by: Lamberti Fabrizio | last post by:
Hi all, in an html page I'm using databinding inside a table, but I'd like setting datasrc runtime at window_on_load event. I can do that using datasrc property of the table, but I can't update the table inside the browser after I've set it. If I use method firstPage() on object table I obtain an error. Please help me.
0
7674
by: Timothy White | last post by:
I have a Windows Form Which Displays one record at a time. The DataTable object which is bound to the Form Controls only contains the record that is being displayed. When I need to display a different record, any changes in the current record are saved to an Access Database, the DataTable's Row Collection is Cleared and the New Record is...
4
4203
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox), SqlConnection (sqlConnection), SqlDataAdapter (daLookupData), SqlDataAdapter (daData), DataSet (dsLookupData), and DataSet (dsData), all created via the IDE...
3
3141
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method, depending on which menu item a user selects. Each of these controls follows the same basic pattern: Get a dataset from the database and then display...
1
3619
by: Gary Shell | last post by:
I have a pair of combo boxes on a form. Both have their SelectedValue property bound to a column on a table called "Input_Output". One column is called "Class" and the second is called "SubClass". Each combobox has its datasource, displaymember and SelectedValue member bound to separate tables thru individual datatsets thru individual data...
13
1636
by: Mike | last post by:
My form has multiple checkboxes. The user can select any number of these checkboxes (including none). I have a table in my DB that would have one entry per checkbox if the checkbox has been checked. If it hasn't been checked, then the table will not have an entry. What is the best way to bind my checkboxes to that table (which is loaded...
2
4259
by: John R. Lewis | last post by:
I posted this yesterday with a different email address. I am reposting with my fake-address as given to me by Microsoft so that I can be guraranteed a response from a support representative. Sorry for the repost. I'd like to make use of the asp:Wizard control to present a step-by-step guided experience for my user to fill out a complicated...
2
1351
by: David C | last post by:
I have a drop down list control where I set AppendDataBound to true and added a list item of '<< add new>>' with a value of -1 to use for adding items to the list during data entry. When the user selects the '<< add new The new name is stored in a hidden TextBox and in the Load event I use it to add the record to the lookup table. Below is...
2
2666
by: Nathan Sokalski | last post by:
I have a Repeater that uses a DataSource that has multiple fields. When the values of these fields is displayed in the Repeater, there are fields that are used in combination with other fields as well as by themselves. For example, there may be a firstname field that is used in combination with a lastname field as well as by itself. Using it...
0
7849
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...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
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...
1
5718
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...
0
5394
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...
0
3844
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...
1
2358
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
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.