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)
|
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 ...
|