473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

programatically databinding

Hi,

heres a brief description of what I'm trying to do.

I have a sql table named colors that looks like this:

color_id color_name
1 blue
2 red
3......... and so on

I created a composite custom control overode the
CreateChildControls method where I created a Datalist that
has one child control (a button). I want to bind the
color from my sql table to the button's foreground color

When I include this control into a aspx page i want to see
3 buttons (or as many buttons as I have colors in my
table). I'm having trouble with how to properly databind
to programatically databind to this datalist
programatically

thanks for the help

-J

Nov 16 '05 #1
2 2021
John,

I don't think that ASP.NET controls have this kind of binding in them.
Windows forms would allow you to specify a data source, as well as a
property of that data source, and specify the property you want set as a
result.

I think you will have to set the control color manually, depending on
the color name, as I don't think that web controls support this level of
data binding.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John" <an*******@discussions.microsoft.com> wrote in message
news:0e****************************@phx.gbl...
Hi,

heres a brief description of what I'm trying to do.

I have a sql table named colors that looks like this:

color_id color_name
1 blue
2 red
3......... and so on

I created a composite custom control overode the
CreateChildControls method where I created a Datalist that
has one child control (a button). I want to bind the
color from my sql table to the button's foreground color

When I include this control into a aspx page i want to see
3 buttons (or as many buttons as I have colors in my
table). I'm having trouble with how to properly databind
to programatically databind to this datalist
programatically

thanks for the help

-J

Nov 16 '05 #2
I'm not sure I understand. If I create a regular aspx
page. Create a DataAdapter and generate a dataset and
then put a datalist on the page. I can set the datasource
and datamember properties of the datalist. Then I can put
a button in the datalist, go to it's databinding
properties and bind any of the button's bindable
properties to a column from the dataset. It generates
something like the following in html
Databinder.Eval(Container, "DataItem.color") ...

I'm not sure what you meant by "ASP.NET controls dont have
this kind of binding" maybe I'm misunderstanding you.

thanks

John
-----Original Message-----
John,

I don't think that ASP.NET controls have this kind of binding in them.Windows forms would allow you to specify a data source, as well as aproperty of that data source, and specify the property you want set as aresult.

I think you will have to set the control color manually, depending onthe color name, as I don't think that web controls support this level ofdata binding.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John" <an*******@discussions.microsoft.com> wrote in messagenews:0e****************************@phx.gbl...
Hi,

heres a brief description of what I'm trying to do.

I have a sql table named colors that looks like this:

color_id color_name
1 blue
2 red
3......... and so on

I created a composite custom control overode the
CreateChildControls method where I created a Datalist that has one child control (a button). I want to bind the
color from my sql table to the button's foreground color

When I include this control into a aspx page i want to see 3 buttons (or as many buttons as I have colors in my
table). I'm having trouble with how to properly databind to programatically databind to this datalist
programatically

thanks for the help

-J

.

Nov 16 '05 #3

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"...
0
by: mike | last post by:
Hi, When I programatically Bind a DataSource to DetailsView it does not fire "ModeChanged" event. This is first time i am trying to use ASP.NET DetailsView control. I have played with some 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
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 project—planning, coding, testing,...

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.