Guys,
I need to add some items to a ListBox control on my page but I want to do it on the client side with a JavaScript function. The items that will be added to the control will be collected on the server, on the Page_Load event, and passed to the JavaScript function that would do the actual adding. So, I need some sort of client-side Page_Load event - a javascript function that would run everytime the page loads - but I'm not sure how to implement it. Can anyone tell me how to do this?
It may seem that what I'm doing doesn't make sense but it does. You see, I need to add a few leading spaces to some of the items of the list box for aligning purposes. Adding the leading spaces from the server doesn't work because the spaces get trimmed. I tried adding & nbsp; (without the space between & and n) but the actual string "& nbsp;" (no space) shows up on the list box, rather than an actual space.
I found, however, that when an item with leading spaces is added to the list box through JavaScript code on the client, the leading spaces do show up. So, what I want to do is collect the items on the server, and add them on the client. For this purpose, I need a JavaScript function that would run after the Page_Load event, but before the page is displayed to the user. Can anybody help me out?
Thanks.
JC
We don't see things how they are; we see them how we are.
I need to add some items to a ListBox control on my page but I want to do it on the client side with a JavaScript function. The items that will be added to the control will be collected on the server, on the Page_Load event, and passed to the JavaScript function that would do the actual adding. So, I need some sort of client-side Page_Load event - a javascript function that would run everytime the page loads - but I'm not sure how to implement it. Can anyone tell me how to do this?
It may seem that what I'm doing doesn't make sense but it does. You see, I need to add a few leading spaces to some of the items of the list box for aligning purposes. Adding the leading spaces from the server doesn't work because the spaces get trimmed. I tried adding & nbsp; (without the space between & and n) but the actual string "& nbsp;" (no space) shows up on the list box, rather than an actual space.
I found, however, that when an item with leading spaces is added to the list box through JavaScript code on the client, the leading spaces do show up. So, what I want to do is collect the items on the server, and add them on the client. For this purpose, I need a JavaScript function that would run after the Page_Load event, but before the page is displayed to the user. Can anybody help me out?
Thanks.
JC
We don't see things how they are; we see them how we are.