Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 1st, 2005, 10:11 PM
Registered User
 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Webform listbox databinding to any property

I know that you can bind to any property in a listbox's DataSource in a windows form by using syntax of the format:

Code:
ListBox1.DataBindings.Add(New Binding("BackColor", MyDataSet, "Customers.Background"))
where ListBox1 is a listbox, BackColor is the custom property you want to set by binding, and Customers.Background identifies the column in the dataset MyDataSet that you want to use to dictate the BackColor property.

I've heard that you can also produce an effect similar to that described/demonstrated above the above on a listbox on a webform, though a listbox as it appears on a webform doesn't have a DataBindings property, so the syntax for achieving it must be different if so. Could any of you tell me if I'm mistaken about being able to bind any property of a listbox Web Control to a column from a dataset, and if it is possible what the syntax for achieving that should be, please? Specifically, I'd like the .Font.Bold property of each row in my listbox to be dictated by a field I'm pulling from an Oracle database into a dataset that the listbox uses as its DataSource. The best I've been able to achieve at the moment is binding the .Font.Bold property to a single value from the dataset (e.g. the first record), which makes each row appear bold or not depending on the value that happens to be the case for the 'record' I pick to associate with .Font.Bold.

Hope one of you clever lot can help!

Thanks,
Rach. :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Databinding to a Listbox rwebb616 Visual Basic 2005 Basics 1 June 1st, 2008 04:59 PM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
Set Listbox Selected property DaDeViL VB How-To 7 October 4th, 2006 04:04 PM
Webform listbox control databing to any property Rachel P Classic ASP Basics 2 October 1st, 2005 10:01 PM
can't change label's property on webForm! goldablasha C# 2 February 14th, 2005 12:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.