For Programmers: Free Programming Magazines  


Home > Archive > ASP > December 2006 > How to Auto resize combo in ASP









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to Auto resize combo in ASP
Abdhul Saleem

2006-12-13, 4:06 pm

Hi,

Is there any way to auto resize the dropdown list part of a combo(<select>
tag) so that the dropdown list items are displayed with full text.

By default the combo width is increased according to the long text dropdown
list item. But I dont want that much width of the combo. So I am using fixed
width for <select> tag using pixels.

In Visual Basic it is possible using APIs. But can i use the same APIs in
ASP? If so any help link or code snippet will help me.

Regards,
M. Abdhul Saleem.



Evertjan.

2006-12-13, 4:06 pm

=?Utf-8?B?QWJkaHVsIFNhbGVlbQ==?= wrote on 12 dec 2006 in
microsoft.public.inetserver.asp.general:
> Is there any way to auto resize the dropdown list part of a
> combo(<select> tag) so that the dropdown list items are displayed with
> full text.
>
> By default the combo width is increased according to the long text
> dropdown list item. But I dont want that much width of the combo. So I
> am using fixed width for <select> tag using pixels.
>
> In Visual Basic it is possible using APIs. But can i use the same APIs
> in ASP? If so any help link or code snippet will help me.


Classic ASP is serverside executed code,
so it cannot autosize anything in a browser.

Something like size = <% = calculatedsize %> micht be done.

However as you use the word, 'combo',
it seems you are referring to asp.net.

This NG is a classic asp group.

Dotnet questions should be asked in
<microsoft.public.dotnet.framework.aspnet>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Abdhul Saleem

2006-12-13, 4:06 pm

Evertjan,

I am using ASP only and not ASP.NET. I am referring <select> tag.

I saw a code snippet in the following URL to achieve this in Visual Basic
http://vbnet.mvps.org/index.html?co...mbowidthadv.htm

Is there any way to use the code snippet in ASP? Because some APIs are used.
I don't have idea of working with APIs in ASP. Please provide me some help
links on working with APIs using ASP.

Regards,
M. Abdhul Saleem.

"Evertjan." wrote:

> =?Utf-8?B?QWJkaHVsIFNhbGVlbQ==?= wrote on 12 dec 2006 in
> microsoft.public.inetserver.asp.general:
>
> Classic ASP is serverside executed code,
> so it cannot autosize anything in a browser.
>
> Something like size = <% = calculatedsize %> micht be done.
>
> However as you use the word, 'combo',
> it seems you are referring to asp.net.
>
> This NG is a classic asp group.
>
> Dotnet questions should be asked in
> <microsoft.public.dotnet.framework.aspnet>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
>

Evertjan.

2006-12-13, 4:06 pm

=?Utf-8?B?QWJkaHVsIFNhbGVlbQ==?= wrote on 12 dec 2006 in
microsoft.public.inetserver.asp.general:
> "Evertjan." wrote:
>

[Please do not toppost on usenet]
[color=darkred]
> I am using ASP only and not ASP.NET. I am referring <select> tag.
>
> I saw a code snippet in the following URL to achieve this in Visual
> Basic http://vbnet.mvps.org/index.html?co...mbowidthadv.htm
>
> Is there any way to use the code snippet in ASP? Because some APIs are
> used. I don't have idea of working with APIs in ASP. Please provide me
> some help links on working with APIs using ASP.


Again, ASP is executed serverside and only produces HTML as a stream to
the client. VB is executed on the machine itself, but is not a browser
thing.

So an API on serverside would not do any good to the html that is
received clientside.

Please think again about the difference between serverside and clientside
code execution.

So, if you can calculate on the server what size (width, height,
character number, etc) you need on the client,
you can transfer it like I showed above and show here:

<%
calculatedWidth = numberofCharacters * 7
%>

<select style='width:<% = calculatedWidth %>px;color:green;'>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Anthony Jones

2006-12-13, 4:06 pm


"Abdhul Saleem" <AbdhulSaleem@discussions.microsoft.com> wrote in message
news:691AA118-FBA3-4346-8A41-ADECCA1B4CEF@microsoft.com...
> Evertjan,
>
> I am using ASP only and not ASP.NET. I am referring <select> tag.
>
> I saw a code snippet in the following URL to achieve this in Visual Basic
> http://vbnet.mvps.org/index.html?co...mbowidthadv.htm
>
> Is there any way to use the code snippet in ASP? Because some APIs are

used.
> I don't have idea of working with APIs in ASP. Please provide me some help
> links on working with APIs using ASP.



Unless you install an ActiveX component on the client you cannot access APIs
to help you with this.

Your only option is to emulate the combo with a text, button and an
absolutely positioned DIV along with a non-trivial chunk Javascript. You
might find a free library of JS code that can do that.

Best choice would be to design the requirement out of you system.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com