<%@ Import Namespace="System.Data.OleDb" %> <%@ Import Namespace="System.Data" %> <%@ Page Explicit="True" Language=VBScript Debug="True" %> <HTML> <HEAD> <title>Default.aspx</title> <script Runat="Server"> Sub P :oops: age_Load( s As Object, e As EventArgs ) If Not isPostBack Then Dim TopicConnection As OleDbConnection Dim TopicCommand As OleDbCommand TopicConnection = New OleDbConnection _ ("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Request.PhysicalApplicationPath & _ "db\DBForum.mdb)" TopicCommand = New OleDbCommand( _ "Select ThemeID, ThemeNom from Themes", _ TopicConnection ) TopicConnection.Open() TopicDataList.DataSource = _ TopicCommand.ExecuteReader() TopicDataList.DataBind() TopicConnection.Close() End If End Sub Sub SelectTheme(s As Object, _ e As DataListCommandEventArgs) Dim ThemeID,ThemeNom As String ThemeNom = e.CommandArgument ThemeID = _ TopicDataList.DataKeys.Item( _ e.Item.ItemIndex).toString() Response.Redirect("Themes.aspx?ThemeID=" & _ ThemeID & "&ThemeNom=" & ThemeNom) End Sub </script> </HEAD> <body> <font face="arial"> <h1><font color="#cc0066"> Forums</font></h1> <font size="5"><i>Sujets de discussion</i></font> <form Runat="Server"> <asp:DataList id="TopicDataList" cellpadding="10" cellspacing="0" gridlines="both" RepeatColumns="3" RepeatDirection="Horizontal" Width="100%" DataKeyField="ThemeID" OnItemCommand="SelectTheme" Runat="Server"> <ItemTemplate> <asp:LinkButton id="TopicLink" Text='<%# Container.DataItem("ThemeNom") %>' CommandArgument='<%# Container.DataItem("ThemeNom") %>' Runat="Server"/> </asp:LinkButton> </ItemTemplate> </asp:DataList> </font></form> </body> </HTML>
Ajouter un commentaire
ven, 06/04/2007 - 21:49
le navigateur me demande un ; la ou ily a le smiley