473,591 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ 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.Da taTextField = "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 1312
Peter Osawa <po****@sun.e s> 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.Da taTextField = "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.e s> 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.Da taTextField = "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.e s> 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.Da taTextField = "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
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 the results using basic databinding. Everything works fine except that I'll occaisionally get an...
3
1850
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 automatically generated, and the objectdatasource let you design against a business object through the gui. Now I am working on my first real web application on 2.0, and I find this automatic functionality doesn't do much beyond allowing me to generate...
4
1645
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 following which I know works when I use it by itself: text='<%# DataBinder.Eval(Container,"DataItem.membernames.lname") %>' What I need to do is somehow concatenate this databinding expression, a comma, and another databinding expression for the...
9
2092
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 form, have the user fill it out then put the data into a class representing a data row and then use the OLEadaptor or OLECommands to update the database. My question is has anyone really used databinding in anything but the simpliest application...
8
2173
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...
0
1318
by: Wayne Sepega | last post by:
I have the following Object DataSource <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetCustomer" TypeName="Customers" DataObjectTypeName="Customer" InsertMethod="InsertCustomer" OnUpdated="ObjectDataSource1_Updated" UpdateMethod="UpdateCustomer" OnSelected="ObjectDataSource1_Selected">
9
24776
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 page life cycle. In this example the event fires twice when a) GridView EnableViewState=False and any image type control in the <columns/> element. When either EnableViewState is set to true or the image button is removed, the event fires once....
8
2080
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
1
1622
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 ?
0
2205
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. When you hover over it with the mouse, a ControlTip Text of "Toolbar Options" is displayed. If you then click on the dropdrown arrow, it displays a popup menu of "Add or Remove Buttons", with a fly-out menu with the toolbar name at the top and...
0
7934
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8236
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8362
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7992
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
8225
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...
0
6639
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5400
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();...
1
2378
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
1465
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.