Drop down list

Hi All,

In a drop down box i am populating all the weeks from 1 to 52, but
whenever the page loads, i want it show the current week number as
selected value.


Below is what is did:


<option selected value="<% DatePart("ww", Now()) %>"> <% wkCnt %> </
option>


But when my page loads, the drop down box shows the last week in the
list (52), instead of current week which is 43.


please let me know i am missing something.


appreciate any ideas on this.


Thank you!!


Navin
navin [ Do, 25 Oktober 2007 20:28 ] [ ID #1854435 ]

Re: Drop down list

navin wrote:
> Hi All,
>
> In a drop down box i am populating all the weeks from 1 to 52, but
> whenever the page loads, i want it show the current week number as
> selected value.
>
>
> Below is what is did:
>
>
> <option selected value="<% DatePart("ww", Now()) %>"> <% wkCnt %> </
> option>
>
>
> But when my page loads, the drop down box shows the last week in the
> list (52), instead of current week which is 43.
>
>
View Source to see the actual output.of you server-side code. If that
does not provide the clue for you, you need to show us how to reproduce
the symptom: show us the rest of the code to generate the options.

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.
reb01501 [ Do, 25 Oktober 2007 20:45 ] [ ID #1854436 ]

Re: Drop down list

On Oct 25, 11:45 pm, "Bob Barrows [MVP]" <reb01... [at] NOyahoo.SPAMcom>
wrote:
> navin wrote:
> > Hi All,
>
> > In a drop down box i am populating all the weeks from 1 to 52, but
> > whenever the page loads, i want it show the current week number as
> > selected value.
>
> > Below is what is did:
>
> > <option selected value="<% DatePart("ww", Now()) %>"> <% wkCnt %> </
> > option>
>
> > But when my page loads, the drop down box shows the last week in the
> > list (52), instead of current week which is 43.
>
> View Source to see the actual output.of you server-side code. If that
> does not provide the clue for you, you need to show us how to reproduce
> the symptom: show us the rest of the code to generate the options.
>
> 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.- Hide quoted text -
>
> - Show quoted text -

I am using the below code to populate the drop down with all the 52
weeks.

<p><select size="1" name="actDate">
<%
Dim wkCnt

for wkCnt = 1 to 52
%>
<option selected value="<% DatePart("ww", Now()) %>"> <% wkCnt %> </
option>
<% Next %>

</select></p>


thanks,
Navin
navin [ Do, 25 Oktober 2007 23:33 ] [ ID #1854437 ]

Re: Drop down list

"navin" <navin.narayana [at] gmail.com> wrote in message
news:1193348024.717945.81660 [at] o38g2000hse.googlegroups.com...
> On Oct 25, 11:45 pm, "Bob Barrows [MVP]" <reb01... [at] NOyahoo.SPAMcom>
> wrote:
> > navin wrote:
> > > Hi All,
> >
> > > In a drop down box i am populating all the weeks from 1 to 52, but
> > > whenever the page loads, i want it show the current week number as
> > > selected value.
> >
> > > Below is what is did:
> >
> > > <option selected value="<% DatePart("ww", Now()) %>"> <% wkCnt %> </
> > > option>
> >
> > > But when my page loads, the drop down box shows the last week in the
> > > list (52), instead of current week which is 43.
> >
> > View Source to see the actual output.of you server-side code. If that
> > does not provide the clue for you, you need to show us how to reproduce
> > the symptom: show us the rest of the code to generate the options.
> >
> > 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.- Hide quoted text -
> >
> > - Show quoted text -
>
> I am using the below code to populate the drop down with all the 52
> weeks.
>
> <p><select size="1" name="actDate">
> <%
> Dim wkCnt
>
> for wkCnt = 1 to 52
> %>
> <option selected value="<% DatePart("ww", Now()) %>"> <% wkCnt %> </
> option>
> <% Next %>
>
> </select></p>

Perhaps you want the following:

<p>
<select name="actDate" size="1">
<% Dim wkCnt, wkNow
For wkCnt = 1 To 52
wkNow = ""
If wkCnt = DatePart("ww",Now) Then wkNow = " selected"
%>
<option value='" & wkCnt & "'" & wkNow & ">" & wkCnt & "</option>"
<% Next %>
</select>
</p>
McKirahan [ Fr, 26 Oktober 2007 00:32 ] [ ID #1854438 ]
Webserver » microsoft.public.inetserver.asp.db » Drop down list

Vorheriges Thema: Updating text box based on value from Drop down
Nächstes Thema: Page inserting blank