ok....det kunne næsten ikke være mere simpelt:
<%@ Page Language="VB" Debug="True"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script Language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
If Not Page.IsPostBack Then
DataBind()
End If
End Sub
Sub DataBind()
Dim DS As DataSet
Dim MyConnection As OleDbConnection
Dim MyCommand As OleDbDataAdapter
MyConnection = New OleDbConnection(System.Configuration.ConfigurationSettings.AppSettings("connectionstring"))
DS = New DataSet()
MyCommand = New OleDbDataAdapter("select [Pages].[PageId], [Pages].[PageNavText] from Pages", MyConnection)
MyCommand.Fill(DS, "Pages")
MenuItems.DataSource = DS.Tables("Pages").DefaultView
MenuItems.DataBind()
End Sub
Sub DataList_ItemCommand(sender As Object, e As DataListCommandEventArgs)
If e.CommandSource.CommandName = "select" Then
MenuItems.SelectedIndex = e.Item.ItemIndex
End If
DataBind()
End Sub
</script>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<title>test repeater.aspx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="tabs.css" />
</head>
<body>
<form runat="server">
<asp:datalist id="MenuItems" runat="server" RepeatDirection="Horizontal" OnItemCommand="DataList_ItemCommand" ItemStyle-CssClass="tabpanel" SelectedItemStyle-CssClass="tabpanel_active">
<HeaderTemplate>header-------</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="MenuLink" runat="server" CommandName="select"><%# DataBinder.Eval(Container.DataItem, "PageNavText") %></asp:LinkButton>
</ItemTemplate>
<SelectedItemTemplate>
<asp:LinkButton ID="MenuLink" runat="server" CommandName="select"><%# DataBinder.Eval(Container.DataItem, "PageNavText") %></asp:LinkButton>
</SelectedItemTemplate>
<FooterTemplate>----------footer</FooterTemplate>
</asp:dataList>
</form>
</body>
</html>
Mvh
P_pippi