CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Listbox - How can I limit number of chars in the list

Print topic Send  topic

Author Message
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
View profile  Send private message
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!!!!!!!
View profile  Send private message
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 :-D

Take Care

Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
infobih

Posts: 58
Posted: 07/15/2006, 8:58 AM

This helps.

Thank you very much for your help as always.
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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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