infobih
Posts: 58
|
| Posted: 07/13/2006, 4:19 AM |
|
In my listbox I have values of articles titles whose are long. How can I limit number of chars to 80 for example??
Thank you
|
 |
 |
marcwolf
Posts: 361
|
| Posted: 07/13/2006, 6:14 PM |
|
Hi there infobih
OK - there are 2 ways to do this.
Firstly you can do it on the database side by doing the equivelent of a 'left'
i.e. select left(country,30) as country1 from .......
You will need to work out re your database syntax what the correct command is.
You can then put this in the Build Query section for the Listbox
Alternatively you can use the on before show for the listbox and modify it there. When this is called the contents of the listbox are stored in an array and you can spool through this array and make changes to it. i.e.
Function yourlistbox_BeforeShow()
Dim I
For I=0 To UBound(EventCaller.ItemsList)
If len(EventCaller.ItemsList(I)) > 30 then
EventCaller.ItemsList(I) = left(EventCaller.ItemsList(I),30)
End If
Next
End Function
Hopes this helps
Take Care
Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
|
 |
 |
DonB
|
| Posted: 07/13/2006, 7:59 PM |
|
There might be a third way. Specify these CSS attributes on the <select>
tag and perhaps on the<option> tags: "Width:nn", "Overflow: hidden". In
theory, that should lock the width to whatever you need, and chop off
anything that doesn't fit in the allotted space.
--
DonB
http://www.gotodon.com/ccbth
"marcwolf" <marcwolf@forum.codecharge> wrote in message
news:644b6eff895a3a@news.codecharge.com...
> Hi there infobih
>
> OK - there are 2 ways to do this.
>
> Firstly you can do it on the database side by doing the equivelent of a
'left'
>
> i.e. select left(country,30) as country1 from .......
>
> You will need to work out re your database syntax what the correct command
is.
>
> You can then put this in the Build Query section for the Listbox
>
>
> Alternatively you can use the on before show for the listbox and modify it
> there. When this is called the contents of the listbox are stored in an
array
> and you can spool through this array and make changes to it. i.e.
>
>
>
> Function yourlistbox_BeforeShow()
> Dim I
> For I=0 To UBound(EventCaller.ItemsList)
> If len(EventCaller.ItemsList(I)) > 30 then
> EventCaller.ItemsList(I) = left(EventCaller.ItemsList(I),30)
> End If
> Next
>
> End Function
>
>
> Hopes this helps
> Take Care
>
> Dave
>
>
>
> _________________
> ' Coding Coding Coding
> Keep Those Keyboards Coding.
> Raw Code!!!!!!!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
marcwolf
Posts: 361
|
| Posted: 07/13/2006, 9:33 PM |
|
Thanks Don
I had not thought of the Style Sheet solution. - Something more to read about 
Take Care
Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
|
 |
 |
infobih
Posts: 58
|
| Posted: 07/15/2006, 8:58 AM |
|
This helps.
Thank you very much for your help as always.
|
 |
 |
|