Foros del Web » Programación para mayores de 30 ;) » .NET »

Como pasar varias variables por sesion

Estas en el tema de Como pasar varias variables por sesion en el foro de .NET en Foros del Web. holas una ayuda. Tengo un repeater anidado formado por combos, lo que hago es obtener los item de esos combos para grabar en un contador, ...
  #1 (permalink)  
Antiguo 08/08/2008, 15:44
 
Fecha de Ingreso: agosto-2008
Mensajes: 1
Antigüedad: 15 años, 9 meses
Puntos: 0
Como pasar varias variables por sesion

holas una ayuda.
Tengo un repeater anidado formado por combos, lo que hago es obtener los item de esos combos para grabar en un contador, mi poblema surge cuadno al tener 3 paginas web, tengo que grabar en la ultima como pasar las variables sabienod ke no sabemos qyue la cantidad no es fija, para grabarlo al final.
agradecere su aporte.
uso asp.net y sql2000
  #2 (permalink)  
Antiguo 10/08/2008, 23:11
Avatar de mazingerz  
Fecha de Ingreso: febrero-2003
Ubicación: Sarasota FL
Mensajes: 147
Antigüedad: 21 años, 3 meses
Puntos: 0
Respuesta: Como pasar varias variables por sesion

estimado lualhulo, por que no usas controles anidados en tus combos?
Revisa este ejemplo, creo que es lo que deberias implementar.

Saludos


formulario
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmControlAnidados.aspx.vb" Inherits="frmControlAnidados" %>

<!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>Página sin título</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width: 235px">
<tr>
<td>
</td>
<td>
<strong>Clase de Controles Anidados</strong></td>
<td style="width: 7px">
</td>
</tr>
<tr>
<td>
</td>
<td style="text-align: center">
<asp:DropDownList ID="DD_Region" runat="server" AutoPostBack="True">
</asp:DropDownList></td>
<td style="width: 7px">
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td style="width: 7px">
</td>
</tr>
<tr>
<td style="height: 21px">
</td>
<td style="height: 21px; text-align: center">
<asp:ListBox ID="LB_Territorio" runat="server"></asp:ListBox></td>
<td style="width: 7px; height: 21px">
</td>
</tr>
</table>

</div>
</form>
</body>
</html>

codigo vb

Imports System.Data
Imports System.Data.SqlClient


Partial Class frmControlAnidados
Inherits System.Web.UI.Page
Public cnx As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\SQL Server 2000 Sample Databases\NORTHWND.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True"

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If (Not Page.IsPostBack) Then

Call CargaRegion()
Call CargarTerritorio(DD_Region.SelectedItem.Value)


End If
End Sub
Sub CargaRegion()


Dim strSQL As String = "Select * From Region "
Dim cnn As New SqlConnection(cnx)
Dim DS_Region As New DataSet


Try
cnn.Open()
Dim DA_Region As New SqlDataAdapter(strSQL, cnn)
DA_Region.Fill(DS_Region, "Region")

DS_Region.WriteXml("c:\region.xml")

DD_Region.DataTextField = "RegionDescription"
DD_Region.DataValueField = "RegionID"
DD_Region.DataSource = DS_Region.Tables("Region").DefaultView
DD_Region.DataBind()
Catch ex As Exception
Finally

cnn.Close()

End Try

End Sub
Sub CargarTerritorio(ByVal str_Id As String)

Dim strSQL As String = "Select TerritoryID, TerritoryDescription From Territories " & _
" Where RegionID ='" + str_Id + "' Order by TerritoryDescription "
Response.Write("SQL : " + strSQL)


Dim cnn As New SqlConnection(cnx)
Dim DS_Territorio As New DataSet


Try
cnn.Open()
Dim DA_Territorio As New SqlDataAdapter(strSQL, cnn)
DA_Territorio.Fill(DS_Territorio, "Territorio")
DS_Territorio.WriteXml("c:\territorio.xml")
LB_Territorio.DataTextField = "TerritoryDescription"
LB_Territorio.DataValueField = "TerritoryID"
LB_Territorio.DataSource = DS_Territorio.Tables("Territorio").DefaultView
LB_Territorio.DataBind()
Catch ex As Exception

Finally

cnn.Close()

End Try
End Sub

Protected Sub DD_Region_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DD_Region.SelectedIndexChanged
' Call CargarTerritorio(DD_Region.SelectedItem.Value)
End Sub
End Class
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:38.