How do I make a value the default value for a combo box in ASP 3.0?
What I have below does NOT work, yet I've seen it in HTML file
examples before (and works if I put it in a HTML file by itself, but
not if I use it in a ASP 3.0 app.
Re: Default value for combo box
am 24.02.2007 10:02:28 von Mike Brind
"Doogie" wrote in message
news:1172274610.316351.140100@s48g2000cws.googlegroups.com.. .
> How do I make a value the default value for a combo box in ASP 3.0?
> What I have below does NOT work, yet I've seen it in HTML file
> examples before (and works if I put it in a HTML file by itself, but
> not if I use it in a ASP 3.0 app.
>
>
>
>
While the above is not valid html, it should work in most browsers, because
they appear to ignore what comes after "selected"
Valid in html 4.01 and below:
Valid in xhtml:
What you tried should also work in most browsers in an ASP app, because all
asp does is render html. ASP is therefore not an issue.
--
Mike Brind
Re: Default value for combo box
am 25.02.2007 01:30:20 von Doogie
> While the above is not valid html, it should work in most browsers, because
> they appear to ignore what comes after "selected"
What is invalid about it? I want to make it valid so if it's invalid
please show me where.
> Valid in html 4.01 and below:
> Valid in xhtml:
Neither of these work. I can create this combo box in a simple html
page and it works fine. But if I put it in an ASP 3.0 page, option 09
is not the default one. Option 08 (the first one) is. Is there some
other way - other than putting 09 first?
Re: Default value for combo box
am 25.02.2007 03:24:28 von mmcginty
"Doogie" wrote in message
news:1172363420.051060.146300@8g2000cwh.googlegroups.com...
>> While the above is not valid html, it should work in most browsers,
>> because
>> they appear to ignore what comes after "selected"
>
> What is invalid about it? I want to make it valid so if it's invalid
> please show me where.
>
>> Valid in html 4.01 and below:
>> Valid in xhtml:
>
> Neither of these work. I can create this combo box in a simple html
> page and it works fine. But if I put it in an ASP 3.0 page, option 09
> is not the default one. Option 08 (the first one) is. Is there some
> other way - other than putting 09 first?
>
Did you view the HTML source as generated by your ASP script? I suspect it
is not generating exactly as you expect, because the browser doesn't care if
the markup is static or dynamic, as long as its correct.
-Mark
Re: Default value for combo box
am 25.02.2007 05:24:49 von Doogie
> Did you view the HTML source as generated by your ASP script? I suspect it
> is not generating exactly as you expect, because the browser doesn't care if
> the markup is static or dynamic, as long as its correct.
Bear with me, I'm a little new to the web dev world. But if you mean
did I do a "View source" on my asp page, I did and the HTML is as
listed above (and below). This is a brand new control on this page,
so there is no other code attached to it yet so I can't figure out why
it won't default to 09 like I'm being told it should.
The only thing else I can think of about this is that this combo box
is being added to a grid that is defined with XSL. The html below is
not part of the XSL, it's part of the HTML of the ASP page though. I
tried to add this code to that XSL too and it didn't change my
results.
Re: Default value for combo box
am 25.02.2007 20:47:30 von Mike Brind
"Doogie" wrote in message
news:1172363420.051060.146300@8g2000cwh.googlegroups.com...
>> While the above is not valid html, it should work in most browsers,
>> because
>> they appear to ignore what comes after "selected"
>
> What is invalid about it? I want to make it valid so if it's invalid
> please show me where.
The selected attribute in html 4.01 and below stands on its own In xhtml it
has to have the attribute and its value, hence selected="selected".
selected="true" does not exist in html or xhtml.
>
>> Valid in html 4.01 and below:
>> Valid in xhtml:
>
> Neither of these work. I can create this combo box in a simple html
> page and it works fine. But if I put it in an ASP 3.0 page, option 09
> is not the default one. Option 08 (the first one) is. Is there some
> other way - other than putting 09 first?
>
They both work in my tests, as they should. Why they don't for you is a
mystery. Please post the resulting source code from your page, and the
relevant lines of ASP that you use to generate the Select list html.
Incidentally, there is no such thing as a "combo box" in asp or html. ASP
is a technology that renders html on request according to the instructions
you give it in your code. The resulting html is then rendered by a browser
as best it can. Stricly speaking, this is not an ASP problem, it's an html
one.
--
Mike Brind
Re: Default value for combo box
am 25.02.2007 21:01:37 von Dave Anderson
"Doogie" wrote:
> But if you mean did I do a "View source" on my asp page, I
> did and the HTML is as listed above (and below).
>
>
Then you know that you are generating invalid HTML. Fix your code so it
assigns the selected attribute the value "selected", not "true".
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Re: Default value for combo box
am 25.02.2007 22:34:27 von Doogie
I switched it to "selected ="selected"" and that still does not work.
The "View Source" shows it as "selected="selected"" but the first
option - Company 08 - is the one that shows as the default. I've
tried it with just "selected" and that does not work either.
Here is the entire HTML for this one page. I'm not sure how much help
it will be because the app is many more pages than this and this
particular grid is loaded with some java script according to an xsl
file. But it shows that I clearly have it set the way I'm describing,
but it is not showing the default the way I need it to. Like I
mentioned, the html entry that I'm creating (cbocompany) is entirely
brand new, so there shouldn't be any code prohibiting it from using
the selected attribute as intended.