Actividad 4
Actividad 4
Actividad 4
Realizar el CRUD o ABM de la tabla Producto basado en el avance con Entity Framework y base
de datos Proyecto de Clases.
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
.auto-style2 {
width: 137px;
</style>
</head>
<body>
<div>
<table class="auto-style1">
<tr>
<td>
<table class="auto-style1">
<tr>
<td class="auto-style2">
</td>
<td class="auto-style5"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">
<td class="auto-style10">
</td>
<td class="auto-style11"></td>
</tr>
<tr>
<td class="auto-style2">
</td>
<td class="auto-style5">
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">
</td>
<td class="auto-style5">
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">
</td>
<td class="auto-style7">
</td>
<td class="auto-style8"></td>
</tr>
<tr>
<td class="auto-style2">
</td>
<td class="auto-style5">
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">
</td>
<td class="auto-style5">
</asp:DropDownList>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style5"> </td>
<td> </td>
</tr>
</table>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> &nb
sp; &nbs
p;
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
<title></title>
<style type=”text/css”>
.auto-style1 {
Width: 100%;
.auto-style4 {
Text-decoration: underline;
Color: #0000FF;
Width: 339px;
Height: 18px;
.auto-style2 {
Text-decoration: underline;
Color: #0000FF;
Width: 339px;
</style>
</head>
<body>
<table class=”auto-style1”>
<tr>
<td>
<table class=”auto-style1”>
<tr>
</tr>
<tr>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
</Columns>
</asp:GridView>
<br />
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
Namespace Actividad4
{
Protected void Page_Load(object sender, EventArgs e)
If (¡Page.IsPostBack)
Refreshdata();
This.DropDownList1.DataSource = lst.ToList();
This.DropDownList1.DataTextField = “nombre”;
This.DropDownList1.DataValueField = “id”;
This.DropDownList1.DataBind();
{
Producto oProducto = new producto();
oProducto.id = int.Parse(this.TextBox7.Text);
oProducto.nombre = this.TextBox8.Text;
oProducto.pcosto = decimal.Parse(this.TextBox4.Text);
oProducto.pventa = decimal.Parse(this.TextBox9.Text);
oProducto.stock = decimal.Parse(this.TextBox10.Text);
oProducto.IdCategoria= int.Parse(idcategoria);
db.producto.Add(oProducto);
db.SaveChanges();//GRABANDO BD
This.Insertar();
Response.Redirect(“WebForm1.aspx”);