Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/04/2008, 11:52
roger1187
 
Fecha de Ingreso: marzo-2008
Mensajes: 286
Antigüedad: 16 años, 1 mes
Puntos: 1
relacionar 2 paginas... maestra y detalle

me explico 1 poco.....tengo 2 paginas ...1 pagina maestro.aspx q tiene 1 listado d la tabla categoria ....q tiene 3 campos ....idcategoria.. nombre categoria .y descripcion...
cuando pongo click sobre cualkiera del listado d la columna nombre d categoria me manda a la pagina detalle.aspx... q tiene 1 listado d la tabla productos y tiene entre sus columnas la idcategoria ...q es la q se relaciona con la tabla categoria

paso el codigo d las 2 paginas ..y tb las tablas para q me puedan explicar xfavor

MAESTRO ASPX......

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="rscategorias"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING_cn") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABASETYPE_cn") %>'
CommandText='<%# "SELECT IdCategoria, NombreCategoria, Descripcion FROM dbo.Categorias" %>'
Debug="true"
></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<form runat="server">
<asp:DataGrid id="dgcategorias"
runat="server"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ShowFooter="false"
ShowHeader="true"
DataSource="<%# rscategorias.DefaultView %>"
AllowPaging="false"
>
<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<Columns>
<asp:BoundColumn DataField="IdCategoria"
HeaderText="IdCategoria"
ReadOnly="true"
Visible="True"/>
<asp:HyperLinkColumn
HeaderText="NombreCategoria"
Visible="True"
DataTextField="NombreCategoria"
DataNavigateUrlField="IdCategoria"
DataNavigateUrlFormatString="../detalle.aspx?IdCategoria={0}"/>
<asp:BoundColumn DataField="Descripcion"
HeaderText="Descripcion"
ReadOnly="true"
Visible="True"/>
</Columns>
</asp:DataGrid>
</form>
</body>
</html>


:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::: ::::

DETALLE.ASPX

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="rsproductos"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING_cn") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABASETYPE_cn") %>'
CommandText='<%# "SELECT * FROM dbo.Productos WHERE IdCategoria = @IdCategoria" %>'
FailureURL='<%# "../maestro.aspx" %>'
Debug="true"
><Parameters>
<Parameter Name="@IdCategoria" Value='<%# IIf((Request.QueryString("IdCategoria") <> Nothing), Request.QueryString("IdCategoria"), "") %>' Type="Int" /></Parameters></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<form runat="server">
<asp:DataGrid id="dgproductos"
runat="server"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ShowFooter="false"
ShowHeader="true"
DataSource="<%# rsproductos.DefaultView %>"
PagerStyle-Mode="NextPrev"
>
<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<Columns>
<asp:BoundColumn DataField="IdProducto"
HeaderText="IdProducto"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Nombreproducto"
HeaderText="Nombre de producto"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="IdProveedor"
HeaderText="IdProveedor"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="IdCategoria"
HeaderText="IdCategorìa"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Cantidadunidad"
HeaderText="Cantidad por unidad"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Precio por unidad"
HeaderText="Precio por unidad"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Unidades en existencia"
HeaderText="Unidades en existencia"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Unidades pedidas"
HeaderText="Unidades pedidas"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Nivel del nuevo pedido"
HeaderText="Nivel del nuevo pedido"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Suspendido"
HeaderText="Suspendido"
ReadOnly="true"
Visible="True"/>
</Columns>
</asp:DataGrid>
</form>
</body>
</html>


:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::: ::::

la tabla categoria tiene las columnas

IdCategoria INT
NombreCategoria NVARCHAR
Descripcion NTEXT

LA TABLA PRODUCTOS NO CREO Q HAYA PROBLEMAS PERO = SE LAS PASO

IdProducto INT
NombreProducto NVARCHAR
IdProveedor INT
IdCategoria INT
Cantidadunidad NVARCHAR
[Precio por unidad] MONEY
[Unidades en existencia]]] SMALLINT
[[[Unidades pedidas] SMALLINT
[Nivel del nuevo pedido] SMALLINT
Suspendido BIT


:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::: ::::

AL PARECER ME SALE 1 ERROR Q CUANDO PONGO CLICK EN LA PAGINA MAESTRO EN CUALKIERA D LOS NOMBRES D CATEGORIA....ME MANDA EL SGTE ERROR ...



:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::: ::::

ESPERO Q ME AYUDEN YA Q HE PROBADO CREO Q TODO ...Y ME KEDE COMO Q ESTANCADO EN ESTE LUGAR .....