Hi, I'm trying a basic connection to a SQL Server db/table to insert 2 fields value and to retrieve a grid view with all the value from the table (paging enabled). But there is something wrong, because I can't see the forms when I run the project.... here is the code:
######################## CODE ######################### <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Categorias.aspx.cs" Inherits="WABiblioteca.Categorias" %> <!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 runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> </div> <p style="font-family: Arial, Helvetica, sans-serif; font-size: small; font-weight: 700"> Biblioteca Pessoal</p> <p style="font-family: Arial, Helvetica, sans-serif; font-size: small"> Manutenção de Categorias</p> <p style="font-family: Arial, Helvetica, sans-serif; font-size: small"> <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="CodCategoria" DataSourceID="SqlDataSource1"> <EditItemTemplate> CodCategoria: <asp:Label ID="CodCategoriaLabel1" runat="server" Text='<%# Eval("CodCategoria") %>' /> <br /> Categoria: <asp:TextBox ID="CategoriaTextBox" runat="server" Text='<%# Bind("Categoria") %>' /> <br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <InsertItemTemplate> CodCategoria: <asp:TextBox ID="CodCategoriaTextBox" runat="server" Text='<%# Bind("CodCategoria") %>' /> <br /> Categoria: <asp:TextBox ID="CategoriaTextBox" runat="server" Text='<%# Bind("Categoria") %>' /> <br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </InsertItemTemplate> <ItemTemplate> CodCategoria: <asp:Label ID="CodCategoriaLabel" runat="server" Text='<%# Eval("CodCategoria") %>' /> <br /> Categoria: <asp:Label ID="CategoriaLabel" runat="server" Text='< %# Bind("Categoria") %>' /> <br /> </ItemTemplate> </asp:FormView> </p> <p> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" style="font-family: Arial, Helvetica, sans-serif; font- size: small"> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> <asp:CommandField ShowSelectButton="True" /> </Columns> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#999999" /> <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> </asp:GridView> </p> <p> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/ Default.aspx" style="font-family: Arial, Helvetica, sans-serif; font- size: small">Página Principal</asp:HyperLink> </p> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:bibliotecaConnectionString %>" SelectCommand="SELECT * FROM [Categoria]"></asp:SqlDataSource> </form> </body> </html>
