CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 color the options in a listbox

Print topic Send  topic

Author Message
dragoon


Posts: 173
Posted: 02/01/2006, 12:10 PM

Hi there,

I made an administrative page fora project I'm curently working on, as you can see in the picture:


I managed to color some of the options in the select, by adding some custom code in before show event of the listbox:

  
foreach(ListItem li in usersAvailableListBox.Items)  
{  
if ((new TextField("",Settings.Connection1DataAccessObject.ExecuteScalar("SELECT inactive FROM users WHERE user_id='"+li.Value+"'"))).GetFormattedValue("") != String.Empty)  
	li.Attributes.Add("style", "background-color: red;");  
}  

the problem is that the first listbox contains currently over 500 items and performing that loop to verify the condition it takes too much time(at least 10 seconds).

Any ideas to get this faster? Like adding this condition when the select is formed ...not after (if you undestand what I mean)
View profile  Send private message
dragoon


Posts: 173
Posted: 02/01/2006, 2:53 PM

i found the problem: i was affecting couple of records directly from SQL Enterprise Manager and i left the table in firehose mode ...

it's working quite fast.

now, for transfering items from one part to another while preserving the style (in my case background-color), add this to the RightButton_OnClick function:
  
LinkedLB.options[LinkedLB.length-1].style.backgroundColor = AvailableLB.options[j].style.backgroundColor;  

and this to the LeftButton_OnClick function:
  
AvailableLB.options[AvailableLB.length-1].style.backgroundColor = LinkedLB.options[j].style.backgroundColor;  

PS replace j with i; it was interpreted as an italic tag ...
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.