<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Import Namespace = "System.Data" %> <%@ Import Namespace = "MySql.Data.MySqlClient" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> void Page_Load(object sender, EventArgs e) { MySqlConnection dbcon = new MySqlConnection("server=localhost; user id=root; password=**; database=talkback_bc; pooling=false;"); MySqlDataAdapter dbadpt = new MySqlDataAdapter("SELECT * FROM talkback", dbcon); DataSet ds = new DataSet(); dbadpt.Fill(ds, "talkback"); myRept.DataSource = ds.Tables; myRept.DataBind(); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Talkback!</title> </head> <body> <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" /> <ajaxToolkit:Accordion ID="Accordion1" runat="server"> <asp:Repeater ID="myRept" runat="server" > <form id="form1" runat="server"> <HeaderTemplate> <table> <tr> <td style="border: 1px solid black;" bgcolor="Gray"width="250"><b>Headline</b></td> <td style="border: 1px solid black;" bgcolor="Gray" width="100"><b>Writer</b></td> <td style="border: 1px solid black;" bgcolor="Gray" width="200"><b>Email</b></td> </tr> </HeaderTemplate> <Panes> <ItemTemplate> <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server"> <Header> <tr> <td style="border: 1px solid black;" id="head<%#DataBinder.Eval(Container.DataItem, "id")%>" bgcolor="#009900" width="250"><font color="#ffffff"><%#DataBinder.Eval(Container.DataItem, "headline")%></font></td> <td style="border: 1px solid black;" bgcolor="#009900" width="100"><font color="#ffffff"><%#DataBinder.Eval(Container.DataItem, "writer")%></font></td> <td style="border: 1px solid black;" bgcolor="#009900" width="200"><font color="#ffffff"><%#DataBinder.Eval(Container.DataItem, "email")%></font></td> </tr> </Header> <Content> <tr style="margin-left: 50px;"> <td valign="top" width="300" height="70" style="border: 1px solid black;"><%#DataBinder.Eval(Container.DataItem, "content")%></td> </tr> </Content> </ajaxToolkit:AccordionPane> </ItemTemplate> </Panes> <FooterTemplate> </table> </FooterTemplate> </form> </asp:Repeater> </ajaxToolkit:Accordion> </body> </html>
|