Bonjour,

j'ai une DropDownlist rempli grâce à une requête SQL.
J'aimerai pourvoir dire que lors du premier chargement de la page, par défaut ça me mette le 5ème élément par exemple.

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
<asp:DropDownList runat="server" id="Liste_date" Width="280px" Height="19px" AutoPostBack="True" DataTextField="TypeBloc" DataSourceID="SqlDataSource1" DataValueField="TypeBloc">
<asp:ListItem Selected="True"></asp:ListItem>
</asp:DropDownList>
et ma requête SQL :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="Data Source=intranet;Initial Catalog=&quot;gestion entrees&quot;;User ID=sa;Password=spssps" ProviderName="System.Data.SqlClient" SelectCommand="select CONVERT(VARCHAR,date,103) as date from
(
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())-4*7 as date
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())-3*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())-2*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())-1*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+1*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+2*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+3*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+4*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+5*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+6*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+7*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+8*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+9*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+10*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+11*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+12*7
union
select DATEADD(DAY, 1-DatePart(DW, getDate()+1), getDate())+13*7
) as date">
</asp:SqlDataSource>
et je voudrai au début avoir la 5ème ligne (semaine courante) au lieu de la 1ère (comme un selected en HTML).
Comment faire ?

Merci