473,473 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Customize Before Databinding

Hi,

I'm filling a DropDownList with a database data with Databind.

The list is a lot of languages, and I would like to add a string before
each field.

If I do ddlLanguages.DataTextField = "MyString" + "DB_FIELD"; I get an
error, normal...

How do I add what I want before or after de databse info ?

TIA
Nov 18 '05 #1
4 1302
Peter Osawa <po****@sun.es> typed:
Hi,
I'm filling a DropDownList with a database data with Databind.
The list is a lot of languages, and I would like to add a string
before each field.
If I do ddlLanguages.DataTextField = "MyString" + "DB_FIELD"; I get an
error, normal...
How do I add what I want before or after de databse info ?


You can do this in the SELECT, directly in your stored procedure o SQL
statement. Like this:

SELECT 'MyString' + DB_FIELD AS LanguageField FROM DB_TABLE

--
Davide Vernole
MVP ASP/ASP.NET
Microsoft Certified Solution Developer
Nov 18 '05 #2
That's the way I was doing until today, but I want to remove all strings
from code or SPs...

Davide Vernole [MVP] wrote:
Peter Osawa <po****@sun.es> typed:
Hi,
I'm filling a DropDownList with a database data with Databind.
The list is a lot of languages, and I would like to add a string
before each field.
If I do ddlLanguages.DataTextField = "MyString" + "DB_FIELD"; I get an
error, normal...
How do I add what I want before or after de databse info ?

You can do this in the SELECT, directly in your stored procedure o SQL
statement. Like this:

SELECT 'MyString' + DB_FIELD AS LanguageField FROM DB_TABLE

Nov 18 '05 #3
Peter,

why not have a custom collection class, fill it up with
data from the database and bind the dropdownlist with an
object of this class

You can manipulate the properties in the class once
filled up
-----Original Message-----
That's the way I was doing until today, but I want to remove all stringsfrom code or SPs...

Davide Vernole [MVP] wrote:
Peter Osawa <po****@sun.es> typed:
Hi,
I'm filling a DropDownList with a database data with Databind.The list is a lot of languages, and I would like to add a stringbefore each field.
If I do ddlLanguages.DataTextField = "MyString" + "DB_FIELD"; I get anerror, normal...
How do I add what I want before or after de databse
info ?

You can do this in the SELECT, directly in your stored procedure o SQL statement. Like this:

SELECT 'MyString' + DB_FIELD AS LanguageField FROM DB_TABLE

.

Nov 18 '05 #4
Thanks Peter, I will try that way
Nov 18 '05 #5

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

Similar topics

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,...
3
by: John Bailey | last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great. The formview and detailview contorls would automatically layout the controls for you, the update methods were...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
9
by: Dennis | last post by:
I have tried using Databinding for my application but always seem to find it very restrictive (maybe I don't completely understand it enough). I always seem to find it much easier to display a...
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...
0
by: Wayne Sepega | last post by:
I have the following Object DataSource <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetCustomer" TypeName="Customers" DataObjectTypeName="Customer"...
9
by: J055 | last post by:
Hi I have a very simple configuration of the GridView with paging and sorting. When I do a postback the DataBinding event fires twice - in both the ProcessPostData and PreRender stages of the...
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; ...
0
by: Sky | last post by:
I have an Access 2003 front-end database with custom toolbars. The toolbars work fine. One annoying feature is that at the far right edge of each custom toolbar there a small dropdown arrow....
0
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,...
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,...
1
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...
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...
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: 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.