Академический Документы
Профессиональный Документы
Культура Документы
Código de formulario:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 45%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td>
Codigo de Articulo</td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
</td>
<td>
<asp:Button ID="Buscar" runat="server"
onclick="Buscar_Click" Text="Buscar" />
</td>
</tr>
<tr>
<td colspan="3">
<asp:GridView ID="GridView1" runat="server"
CellPadding="4" ForeColor="#333333"
GridLines="None" Height="277px" Width="402px">
<RowStyle BackColor="#FFFBD6" ForeColor="#333333"
/>
<FooterStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#FFCC66"
ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-
Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Código Subyacente:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
}
protected void Buscar_Click1(object sender, EventArgs e)
{
}
}
Nombre de la
Nombre del Método que ejecutara la Tabla
sentencia Select sin paramentros
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 45%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td>
Codigo de Articulo</td>
<td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
<td>
<asp:Button ID="Buscar" runat="server"
onclick="Buscar_Click" Text="Buscar" />
</td>
</tr>
<tr>
<td colspan="3">
<asp:GridView ID="GridView1" runat="server"
CellPadding="4" ForeColor="#333333"
GridLines="None" Height="277px" Width="402px">
<RowStyle BackColor="#FFFBD6" ForeColor="#333333"
/>
<FooterStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#FFCC66"
ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-
Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Codigo subyacente:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
dspedidos2TableAdapters.ArticuloTableAdapter adarticulo =
new dspedidos2TableAdapters.ArticuloTableAdapter();
adarticulo.FillByartcodigo(dspedidos.Articulo, codigo);
if (dspedidos.Articulo.Rows.Count == 0)
{
this.Label1.Text = "Codigo no Existe";
}
this.GridView1.DataSource = dspedidos.Articulo;
this.GridView1.DataBind();