473,856 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Usual Databinding Question - UNusual Requirements


I have a rather unusual request about a rather basic need. I need to be
able to bind data to a page, but WITHOUT using a Repeater, DataGrid or


Well, I have some formatting and JavaScript issues that require each and
every form element's ID to remain unchanged. Unfortunately, whenever
data binding occurs within a Repeater, DataList or DataGrid, the form
ID’s are changed to something different (i.e., there is additional stuff
appended to the ID name to allow ASP.NET to track it).

I know I can data bind a single item to a single form element by using
ExecuteScalar() . That is, the following works great if all I want is to
bind the contents of a single database field to a single form element:

Sub EditIntro()
Dim myConn as New
OleDbConnection (ConfigurationS ettings.AppSett ings("strConn") )
Dim myCmd as New OleDbCommand("S ELECT [Comment] FROM [tblIntro]", myConn)
ltrlIntro.Text = FormatData(myCm d.ExecuteScalar ())
IntroComment.Te xt = myCmd.ExecuteSc alar()
End Sub

In this example, a single database field (for which only one entry, or
row, exists) is bound to both a literal (providing an excellent preview
of the database field’s contents) as well as a form <textarea> (so that
the current contents of the database field can be displayed and any
changes updated).

However, I need to be able to bind multiple database fields of just a
single database entry (or row) to multiple literals and multiple form
fields. Since I will be calling up just one database entry, I do not
want to use a Repeater, DataList or DataGrid, since these are best used
for displaying multiple database entries and will muck up the ID’s that
are used by the form fields.

Are there any online resources that I can be pointed to? Or does anyone
have any ideas?

PS, I would like any solution, if possible, to be applicable to both
ASP.NET 1.1 as well as ASP.NET 2.0. I am building an XHTML 1.1 + CSS 2.1
compliant web app, so I need flexibility.

*************** *************** *************** *************** ***********
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
*************** *************** *************** *************** ***********
“Anyone who believes in Intelligent Design (“creationism ”) is just as
ignorant and ill-educated as someone who believes that the world is
flat, that the Sun circles the Earth or that there really is a tooth
fairy. Darwinism has an overwhelming foundation of evidence that can be
tested and reproduced. Intelligent Design, on the other hand, has no
evidence at all; not one single shred of testable proof. As such,
Intelligent Design is Religious Mythology, and has no right whatsoever
to be in our Science classrooms.” - 99.99+% of Scientists
*************** *************** *************** *************** ***********
Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
obsessed with sex as the average man.” Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary
woman to keep up with an ordinary man.
*************** *************** *************** *************** ***********
Feb 12 '06 #1
2 1200
try this:
Sub EditIntro()
Dim myConn as
New OleDbConnection (ConfigurationS ettings.AppSett ings("strConn") )
Dim myCmd as New OleDbCommand("S ELECT [Comment] FROM [tblIntro]",

Dim rdr As OleDbDataReader
rdr = myCmd.ExecuteRe ader()

ltrlIntro.Text = FormatData(rdr( "Comment"))
IntroComment.Te xt = rdr("Comment")

End Sub
Now you can add more columns into your select-statement and use use them
in your program any way you want.

*************** *************** *************** *************** ****
Tapio Kulmala

"Those are my principles. If you don't like them I have others."

- Groucho Marx
*************** *************** *************** *************** ****
Feb 14 '06 #2
I'm the awkward type, so I might try and fix the other problem: your
dependency on an ID. I use classes over unique IDs for CSS, and I've
got a quick and dirty JScript function that takes an id and a tagname
and searches for matching elements, returning the first match.

Is there a similar workaround in your case?

Feb 14 '06 #3

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

Similar topics

by: Karlo Basic | last post by:
Greetings! I'm wondering how do the expressions in the following piece of code evaluate and why: #include <iostream> using namespace std; int main() { int n = 5, p;
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 the results using basic databinding. Everything works fine except that I'll occaisionally get an...
by: AC [MVP MCMS] | last post by:
I have a web application that is throwing a common error, but in a very unusual state. I'm specifically receiving the following error: "Failed to start monitoring changes to 'd:\inetpub\wwwroot'." The error is being thrown on one of the <%@ Register %> tags at the top of the ASX page that's registering ASP.NET user controls ASCX we wrote. What's unusual is that this machine only has a single volume (c:\). We built this app in a...
by: Justin Hoffman | last post by:
I am new to vb.net programming and am just exploring the way databinding works with Windows forms and am having trouble with some fairly basic customization of data entry. The form uses the SqlDataAdapter and SqlDataset and loads a very simple table, with both text and integer fields. If a textbox is bound to an integer source where the current value is a valid integer, say 9, I can type in the textbox 'rubbish' and move to another...
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...
by: Neo Geshel | last post by:
Greetings! I have a rather unusual request about a rather basic need. I need to be able to bind data to a page, but WITHOUT using a Repeater, DataGrid or DataList. Why? Well, I have some formatting and JavaScript issues that require each and every form element's ID to remain unchanged. Unfortunately, whenever
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the generic type Field<T> (see sample code). public class Employee { public Field<stringForename
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello to all, I want to know if DataBinding in asp.net 2,0 is better than to fill up the values of the controls of the following form: this.miControlTextBox.Text = valorParaControlTextbox; Performance with databinding is good in asp.net 2.0 ? Would you prefer: databinding or set value to Text property of control ?
by: maya | last post by:
hi, I got this unusual design (well, not so unusual anymore, I guess..) for an input text field for a search form in top of page.. http://www.mayacove.com/design/search/search.html I can't get it to work, have tried lots of things.. have spent lots of time already on it... tried to glean from apple.com, where they have same kind of search input field, but they 'load' the search 'decoration'
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...
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,...
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...
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...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.