all groups > inetserver asp db > october 2007 >
You're in the

inetserver asp db

group:

Drop down list


Drop down list navin
10/25/2007 11:28:47 AM
inetserver asp db:
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
Re: Drop down list navin
10/25/2007 2:33:44 PM
On Oct 25, 11:45 pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
[quoted text, click to view]

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
Re: Drop down list Bob Barrows [MVP]
10/25/2007 2:45:18 PM
[quoted text, click to view]
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.

Re: Drop down list McKirahan
10/25/2007 5:32:27 PM
[quoted text, click to view]

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>

AddThis Social Bookmark Button