To Examples
seeds1.aspx Source Code
<!-- seeds1.aspx Example Display a seed catalog with images. --> <%@ Page Language="C#" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <script runat=server> public void Page_Load(object sender, EventArgs e) { // Create and configure connection string. OleDbConnection c = new OleDbConnection( ); c.ConnectionString = Provider=Microsoft.Jet.OLEDB.4.0; + @Data Source=e:\ectserver\sjost\Database\seeds.mdb; // Create and configure SelectCommand object. OleDbCommand sc = c.CreateCommand( ); sc.Commandclass = Commandclass.Text; sc.CommandText = SELECT * FROM SeedCatalog; // Create DataAdapter object. OleDbDataAdapter da = new OleDbDataAdapter( ); da.SelectCommand = sc; // Create and populate DataSet object. DataSet ds = new DataSet( ); int n = da.Fill(ds, SeedCatalog); // Display data in Repeater object. repSeeds.DataSource = ds; repSeeds.DataBind( ); } </script> <html> <head> <title>seeds1.aspx Example</title> <link rel=stylesheet class=text/css href=examples.css /> <style class=text/css> td { padding-left:0.15cm; padding-right:0.15cm; padding-top:0.15cm; padding-bottom:0.15cm; } img { width:100px; height:100px; } </style> </head> <body> <h2>seeds1.aspx Example</h2> <h3>Display a seed catalog with images using a Repeater control.</h3> <p>HTML textboxes are used because there is not a good way to give ids to Asp.Net CheckBox controls.</p> <form id=frmSelect runat=server> <p> <asp:Repeater ID=repSeeds runat=server> <HeaderTemplate> <table> </HeaderTemplate> <ItemTemplate> <tr> <td> <table> <tr> <td>Catalog Number:</td> <td><%# Eval("CatalogNumber") %></tr> </tr> <td>Item Name:</td> <td><%# Eval("ItemName") %></td> </tr> <tr> <td>Price of Item:</td> <td>$<%# Eval("Price") %> </td> </tr> </table> </td> <td> <img src=images/<%# Eval("ImagePrefix") %>.jpg /> </td> <td> <input class=checkbox id=<%# Eval("CatalogNumber") %> /> Add to Shopping Cart </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </p> </form> </body> </html>