473,473 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Usual Databinding Question - UNusual Requirements

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
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(ConfigurationSettings.AppSettings( "strConn"))
Dim myCmd as New OleDbCommand("SELECT [Comment] FROM [tblIntro]", myConn)
myConn.Open()
ltrlIntro.Text = FormatData(myCmd.ExecuteScalar())
IntroComment.Text = myCmd.ExecuteScalar()
myConn.Close()
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.

TIA
...Geshel
--
************************************************** *********************
* 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 1161
try this:
Sub EditIntro()
Dim myConn as
New OleDbConnection(ConfigurationSettings.AppSettings( "strConn"))
Dim myCmd as New OleDbCommand("SELECT [Comment] FROM [tblIntro]",
myConn)
myConn.Open()

Dim rdr As OleDbDataReader
rdr = myCmd.ExecuteReader()
rdr.Read()

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

myConn.Close()
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

11
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;
3
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,...
0
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'."...
7
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...
8
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...
2
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...
8
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...
1
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; ...
7
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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
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.