Connecting Tech Pros Worldwide Help | Site Map

How to control the size(width of a combo box generated in asp?)

Jack
Guest
 
Posts: n/a
#1: Mar 9 '06
Hi,
I have a asp page where multiple rows for a client is generated using asp.
Some of these are combo boxes and some are text and are coming from a
recordset. Now, the following is the code to geneated one of those combo
boxes.

CODE:
<td align="left">
<font face="Verdana,Arial" color="#000000" size="1">
<select name="txtagency">
<option></option>

<%

Set RS_Agency = Server.CreateObject("ADODB.Recordset")
strSQL1 = "SELECT AgencyId, AgencyName FROM tblAgency"
RS_Agency.Open strSQL1, conn


Do Until RS_Agency.EOF 'populate workcodes
if not RS_Edits("AgencyId") = RS_Agency("AgencyID") then
response.write("<option value=" _
& RS_Agency("AgencyID") & ">" _
& RS_Agency("AgencyName") _
& "</option>")
else
response.write("<option selected value=" _
& RS_Agency("AgencyID") & ">" _
& RS_Agency("AgencyName") _
& "</option>")
end if
RS_Agency.movenext
Loop
RS_Agency.Close
set RS_Agency = nothing
%>
</select>
</td>

I need to reduce the size of this combo box. I would like to know, in the
present scenario, how can one control (reduce) the size of the combo box. I
believe what I am getting is the default value of combo box. Thanks.
Bob Barrows [MVP]
Guest
 
Posts: n/a
#2: Mar 9 '06

re: How to control the size(width of a combo box generated in asp?)


Jack wrote:[color=blue]
> Hi,
> I have a asp page where multiple rows for a client is generated using
> asp. Some of these are combo boxes and some are text and are coming
> from a recordset. Now, the following is the code to geneated one of
> those combo boxes.
>
> CODE:
> <td align="left">
> <font face="Verdana,Arial" color="#000000" size="1">
> <select name="txtagency">[/color]
<snip>[color=blue]
>
> I need to reduce the size of this combo box. I would like to know, in
> the present scenario, how can one control (reduce) the size of the
> combo box. I believe what I am getting is the default value of combo
> box. Thanks.[/color]

HTML/CSS questions will get better response in one of the newsgroups devoted
to those topics (http://groups.google.com/groups/dir?sel=33584039).

Remember, asp generates the html which is sent to the client. So, before you
can get asp to generate the correct html, you have to learn what the correct
html or css is.

"width" is both an attribute of a SELECT element and a style property. It is
more "accepted" these days to use the css style properties. So add a style
attribute to your SELECT element and put in the width you wish the control
to have.

<select name="txtagency" style="width:50px">

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Jack
Guest
 
Posts: n/a
#3: Mar 9 '06

re: How to control the size(width of a combo box generated in asp?)


Thanks a lot Bob. I appreciate your help. I indeed need to learn CSS to know
all these tricks. Best regards.

"Bob Barrows [MVP]" wrote:
[color=blue]
> Jack wrote:[color=green]
> > Hi,
> > I have a asp page where multiple rows for a client is generated using
> > asp. Some of these are combo boxes and some are text and are coming
> > from a recordset. Now, the following is the code to geneated one of
> > those combo boxes.
> >
> > CODE:
> > <td align="left">
> > <font face="Verdana,Arial" color="#000000" size="1">
> > <select name="txtagency">[/color]
> <snip>[color=green]
> >
> > I need to reduce the size of this combo box. I would like to know, in
> > the present scenario, how can one control (reduce) the size of the
> > combo box. I believe what I am getting is the default value of combo
> > box. Thanks.[/color]
>
> HTML/CSS questions will get better response in one of the newsgroups devoted
> to those topics (http://groups.google.com/groups/dir?sel=33584039).
>
> Remember, asp generates the html which is sent to the client. So, before you
> can get asp to generate the correct html, you have to learn what the correct
> html or css is.
>
> "width" is both an attribute of a SELECT element and a style property. It is
> more "accepted" these days to use the css style properties. So add a style
> attribute to your SELECT element and put in the width you wish the control
> to have.
>
> <select name="txtagency" style="width:50px">
>
> Bob Barrows
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>[/color]
Jack
Guest
 
Posts: n/a
#4: Mar 9 '06

re: How to control the size(width of a combo box generated in asp?)


For some reason with the above code there is no change in the width(size) of
the combo box. Any thoughts. Thanks

"Bob Barrows [MVP]" wrote:
[color=blue]
> Jack wrote:[color=green]
> > Hi,
> > I have a asp page where multiple rows for a client is generated using
> > asp. Some of these are combo boxes and some are text and are coming
> > from a recordset. Now, the following is the code to geneated one of
> > those combo boxes.
> >
> > CODE:
> > <td align="left">
> > <font face="Verdana,Arial" color="#000000" size="1">
> > <select name="txtagency">[/color]
> <snip>[color=green]
> >
> > I need to reduce the size of this combo box. I would like to know, in
> > the present scenario, how can one control (reduce) the size of the
> > combo box. I believe what I am getting is the default value of combo
> > box. Thanks.[/color]
>
> HTML/CSS questions will get better response in one of the newsgroups devoted
> to those topics (http://groups.google.com/groups/dir?sel=33584039).
>
> Remember, asp generates the html which is sent to the client. So, before you
> can get asp to generate the correct html, you have to learn what the correct
> html or css is.
>
> "width" is both an attribute of a SELECT element and a style property. It is
> more "accepted" these days to use the css style properties. So add a style
> attribute to your SELECT element and put in the width you wish the control
> to have.
>
> <select name="txtagency" style="width:50px">
>
> Bob Barrows
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>[/color]
Bob Lehmann
Guest
 
Posts: n/a
#5: Mar 10 '06

re: How to control the size(width of a combo box generated in asp?)


>> Any thoughts. Thanks
Yes. Visit a CSS or HTML group.

Bob Lehmann

"Jack" <Jack@discussions.microsoft.com> wrote in message
news:E481CA59-0D1D-40FB-8EB9-AA511DDC32D4@microsoft.com...[color=blue]
> For some reason with the above code there is no change in the width(size)[/color]
of[color=blue]
> the combo box. Any thoughts. Thanks
>
> "Bob Barrows [MVP]" wrote:
>[color=green]
> > Jack wrote:[color=darkred]
> > > Hi,
> > > I have a asp page where multiple rows for a client is generated using
> > > asp. Some of these are combo boxes and some are text and are coming
> > > from a recordset. Now, the following is the code to geneated one of
> > > those combo boxes.
> > >
> > > CODE:
> > > <td align="left">
> > > <font face="Verdana,Arial" color="#000000" size="1">
> > > <select name="txtagency">[/color]
> > <snip>[color=darkred]
> > >
> > > I need to reduce the size of this combo box. I would like to know, in
> > > the present scenario, how can one control (reduce) the size of the
> > > combo box. I believe what I am getting is the default value of combo
> > > box. Thanks.[/color]
> >
> > HTML/CSS questions will get better response in one of the newsgroups[/color][/color]
devoted[color=blue][color=green]
> > to those topics (http://groups.google.com/groups/dir?sel=33584039).
> >
> > Remember, asp generates the html which is sent to the client. So, before[/color][/color]
you[color=blue][color=green]
> > can get asp to generate the correct html, you have to learn what the[/color][/color]
correct[color=blue][color=green]
> > html or css is.
> >
> > "width" is both an attribute of a SELECT element and a style property.[/color][/color]
It is[color=blue][color=green]
> > more "accepted" these days to use the css style properties. So add a[/color][/color]
style[color=blue][color=green]
> > attribute to your SELECT element and put in the width you wish the[/color][/color]
control[color=blue][color=green]
> > to have.
> >
> > <select name="txtagency" style="width:50px">
> >
> > Bob Barrows
> >
> > --
> > Microsoft MVP -- ASP/ASP.NET
> > Please reply to the newsgroup. The email account listed in my From
> > header is my spam trap, so I don't check it very often. You will get a
> > quicker response by posting to the newsgroup.
> >
> >
> >[/color][/color]


Mike Brind
Guest
 
Posts: n/a
#6: Mar 10 '06

re: How to control the size(width of a combo box generated in asp?)



Jack wrote:[color=blue]
> For some reason with the above code there is no change in the width(size) of
> the combo box. Any thoughts. Thanks[/color]

Yes. Two things. First - please don't top post. Doing that means
there is no "above" code, and is destroys the natural reading order
(from top to bottom).

Second, add a semicolon after the value. CSS declaration syntax is as
follows:

property (colon) value (semicolon)

width: 30px;

--
Mike Brind

Mike Brind
Guest
 
Posts: n/a
#7: Mar 10 '06

re: How to control the size(width of a combo box generated in asp?)



Mike Brind wrote:[color=blue]
> Jack wrote:[color=green]
> > For some reason with the above code there is no change in the width(size) of
> > the combo box. Any thoughts. Thanks[/color]
>
> Yes. Two things. First - please don't top post. Doing that means
> there is no "above" code, and is destroys the natural reading order
> (from top to bottom).
>
> Second, add a semicolon after the value. CSS declaration syntax is as
> follows:
>
> property (colon) value (semicolon)
>
> width: 30px;
>
> --
> Mike Brind[/color]

That'll teach me.

I get up at 5.00am to watch a bit of cricket, only to find out that bad
light has stopped play, so go log onto the Internet instead, and then
make posts while still only half awake :-)


Single declarations like the above do not require semi-colons at the
end of them - they're used to delimit multiple declarations.

Going off to snooze.......

--
Mike Brind

Bob Barrows [MVP]
Guest
 
Posts: n/a
#8: Mar 10 '06

re: How to control the size(width of a combo box generated in asp?)


In order to figure that out, we (or the html/css group) would need to see
the resulting html. So run your page, View Source, copy out the part of the
source that contains the <SELECT> element (opton tags and all), and post
that (just that - do not post the entire page unless requested to do so) to
the appropriate group. :-)

That said, maybe you have to use the SELECT's width attribute after all. It
may depend on the browser ...
I'm a little weak in this area myself and cannot answer these types of
questions off the top of my head without resorting to google and/or
trial-and-error.


Jack wrote:[color=blue]
> For some reason with the above code there is no change in the
> width(size) of the combo box. Any thoughts. Thanks
>
> "Bob Barrows [MVP]" wrote:
>[color=green]
>> Jack wrote:[color=darkred]
>>> Hi,
>>> I have a asp page where multiple rows for a client is generated
>>> using asp. Some of these are combo boxes and some are text and are
>>> coming
>>> from a recordset. Now, the following is the code to geneated one of
>>> those combo boxes.
>>>
>>> CODE:
>>> <td align="left">
>>> <font face="Verdana,Arial" color="#000000" size="1">
>>> <select name="txtagency">[/color]
>> <snip>[color=darkred]
>>>
>>> I need to reduce the size of this combo box. I would like to know,
>>> in
>>> the present scenario, how can one control (reduce) the size of the
>>> combo box. I believe what I am getting is the default value of combo
>>> box. Thanks.[/color]
>>
>> HTML/CSS questions will get better response in one of the newsgroups
>> devoted to those topics
>> (http://groups.google.com/groups/dir?sel=33584039).
>>
>> Remember, asp generates the html which is sent to the client. So,
>> before you can get asp to generate the correct html, you have to
>> learn what the correct html or css is.
>>
>> "width" is both an attribute of a SELECT element and a style
>> property. It is more "accepted" these days to use the css style
>> properties. So add a style attribute to your SELECT element and put
>> in the width you wish the control to have.
>>
>> <select name="txtagency" style="width:50px">
>>
>> Bob Barrows
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.[/color][/color]

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Jack
Guest
 
Posts: n/a
#9: Mar 10 '06

re: How to control the size(width of a combo box generated in asp?)


Thanks Bob for your reply. I will do so in the appropriate newsgroup.

"Bob Barrows [MVP]" wrote:
[color=blue]
> In order to figure that out, we (or the html/css group) would need to see
> the resulting html. So run your page, View Source, copy out the part of the
> source that contains the <SELECT> element (opton tags and all), and post
> that (just that - do not post the entire page unless requested to do so) to
> the appropriate group. :-)
>
> That said, maybe you have to use the SELECT's width attribute after all. It
> may depend on the browser ...
> I'm a little weak in this area myself and cannot answer these types of
> questions off the top of my head without resorting to google and/or
> trial-and-error.
>
>
> Jack wrote:[color=green]
> > For some reason with the above code there is no change in the
> > width(size) of the combo box. Any thoughts. Thanks
> >
> > "Bob Barrows [MVP]" wrote:
> >[color=darkred]
> >> Jack wrote:
> >>> Hi,
> >>> I have a asp page where multiple rows for a client is generated
> >>> using asp. Some of these are combo boxes and some are text and are
> >>> coming
> >>> from a recordset. Now, the following is the code to geneated one of
> >>> those combo boxes.
> >>>
> >>> CODE:
> >>> <td align="left">
> >>> <font face="Verdana,Arial" color="#000000" size="1">
> >>> <select name="txtagency">
> >> <snip>
> >>>
> >>> I need to reduce the size of this combo box. I would like to know,
> >>> in
> >>> the present scenario, how can one control (reduce) the size of the
> >>> combo box. I believe what I am getting is the default value of combo
> >>> box. Thanks.
> >>
> >> HTML/CSS questions will get better response in one of the newsgroups
> >> devoted to those topics
> >> (http://groups.google.com/groups/dir?sel=33584039).
> >>
> >> Remember, asp generates the html which is sent to the client. So,
> >> before you can get asp to generate the correct html, you have to
> >> learn what the correct html or css is.
> >>
> >> "width" is both an attribute of a SELECT element and a style
> >> property. It is more "accepted" these days to use the css style
> >> properties. So add a style attribute to your SELECT element and put
> >> in the width you wish the control to have.
> >>
> >> <select name="txtagency" style="width:50px">
> >>
> >> Bob Barrows
> >>
> >> --
> >> Microsoft MVP -- ASP/ASP.NET
> >> Please reply to the newsgroup. The email account listed in my From
> >> header is my spam trap, so I don't check it very often. You will get
> >> a quicker response by posting to the newsgroup.[/color][/color]
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
>[/color]
Closed Thread