crear dinamicamente controles System.Web.UI.MobileControls.SelectionList
Publicado por JOSE SECUNDINO ALVITES RODAS (1 intervención) el 03/09/2011 23:25:10
estoy creando dinamicamente un control chekbox con todas las letras a cobrar que tienen el cliente con el banco, mi problema es que quedan activas las casillas de verificacion seleccionadas del anterior cliente cuando lo cargo para consulatar las letras de otro cliente
Partial Class letrasxcobrar
Inherits System.Web.UI.MobileControls.MobilePage
Private Letra As System.Web.UI.MobileControls.SelectionList = Nothing
Private Titulo As System.Web.UI.MobileControls.Label = Nothing
Private Ruta As String = ConfigurationManager.AppSettings("CadenaConeccion").Trim 'Server.MapPath("")
Private __mesajeerror As String = ""
Private dt As Data.DataTable = Nothing
Private ok As Boolean = True
Protected Sub ControlErrores(ByVal MenError As String, ByVal nompagina As String, ByVal titulo As String)
Response.Clear()
Response.Write("<title>Información</title>")
Response.Write("<center><font color=red><small>" & MenError & "</small></font></center>")
Response.Write("<center><small><a href=" & nompagina & ">" & titulo & "</a></small></center>")
Response.End()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Panelmenu.Controls.Clear()
Dim Datos As Object() = Session("__CAJASIPAN__")
If Datos Is Nothing Then
ControlErrores("Ud. no esta autorizado para ingresar a esta página.", "CerrarSession.aspx", "Iniciar sesión")
Else
Session("__CAJASIPAN__") = Datos
'Me.Labelcliente.Text = Session("__CAJASIPAN__")(1)
Dim l As New letra
l.CONN_STRING = Me.Ruta
If l.AbrirConeccion = True Then
Me.ActiveForm.Action = "reglquida.aspx?_codigo=" & Request.QueryString.Item("_codigo").ToString
l.setidpres = Request.QueryString.Item("_codigo")
dt = l.listaletrasxcobrar
If dt Is Nothing Then
__mesajeerror = l.getMensageError
l.CerrarConeccion()
ControlErrores(__mesajeerror, "~/CerrarSession.aspx", "Iniciar sesión")
Else
Dim NroFilas As Integer = dt.Rows.Count
If NroFilas = 0 Then
l.CerrarConeccion()
ControlErrores("No hay letras para cobrar.", "menu.aspx", "Menú")
Else
Dim j As Integer = 0
For i As Integer = 0 To NroFilas - 1
Me.Labelcliente.Text = dt.Rows(i).Item("cliente").ToString
Letra = New System.Web.UI.MobileControls.SelectionList
Letra.SelectType = MobileControls.ListSelectType.CheckBox
Letra.ID = "Letra" & j.ToString
'Letra.EnableViewState = True
'Letra.Wrapping = MobileControls.Wrapping.NoWrap
Dim lista As New System.Web.UI.MobileControls.MobileListItem
lista.Text = CDate(dt.Rows(i).Item("fechacancelar").ToString).ToShortDateString
lista.Value = dt.Rows(i).Item("idletra").ToString
lista.Selected = False
Letra.Items.Add(lista)
'Letra.Items.Add(CDate(dt.Rows(i).Item("fechacancelar").ToString).ToShortDateString)
'Letra.Items.Item(0).Value = dt.Rows(i).Item("idletra").ToString
'Letra.Items(0).Value = dt.Rows(i).Item("idletra").ToString
'Letra.Items(0).Selected = False
'Letra.Items.Item(0).Selected = False
'Letra.Items.Item(0).DataBind()
Me.Panelmenu.Controls.Add(Letra)
'MsgBox(Me.Panelmenu.Controls(i).ID)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "NRO.CUOTA: " & dt.Rows(i).Item("numeroletra").ToString
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Font.Bold = MobileControls.BooleanOption.True
Titulo.Text = "DIAS DEUDA: " & dt.Rows(i).Item("diasinteres").ToString
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "MONTO S/.: " & Format(dt.Rows(i).Item("montoletra"), "###,###.#0")
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "INTERES S/.: " & Format(dt.Rows(i).Item("interes"), "###,###.#0")
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Font.Bold = MobileControls.BooleanOption.True
Titulo.Text = "TOTAL S/.: " & Format(dt.Rows(i).Item("totalpagar"), "###,###.#0")
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "****************************"
Me.Panelmenu.Controls.Add(Titulo)
j = j + 1
Letra.Dispose()
Next
Session("numlineas") = (j - 1).ToString
l.CerrarConeccion()
End If
End If
Else
__mesajeerror = l.getMensageError
l.CerrarConeccion()
ControlErrores(__mesajeerror, "CerrarSession.aspx", "Iniciar sesión")
End If
End If
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
End Sub
End Class
Partial Class letrasxcobrar
Inherits System.Web.UI.MobileControls.MobilePage
Private Letra As System.Web.UI.MobileControls.SelectionList = Nothing
Private Titulo As System.Web.UI.MobileControls.Label = Nothing
Private Ruta As String = ConfigurationManager.AppSettings("CadenaConeccion").Trim 'Server.MapPath("")
Private __mesajeerror As String = ""
Private dt As Data.DataTable = Nothing
Private ok As Boolean = True
Protected Sub ControlErrores(ByVal MenError As String, ByVal nompagina As String, ByVal titulo As String)
Response.Clear()
Response.Write("<title>Información</title>")
Response.Write("<center><font color=red><small>" & MenError & "</small></font></center>")
Response.Write("<center><small><a href=" & nompagina & ">" & titulo & "</a></small></center>")
Response.End()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Panelmenu.Controls.Clear()
Dim Datos As Object() = Session("__CAJASIPAN__")
If Datos Is Nothing Then
ControlErrores("Ud. no esta autorizado para ingresar a esta página.", "CerrarSession.aspx", "Iniciar sesión")
Else
Session("__CAJASIPAN__") = Datos
'Me.Labelcliente.Text = Session("__CAJASIPAN__")(1)
Dim l As New letra
l.CONN_STRING = Me.Ruta
If l.AbrirConeccion = True Then
Me.ActiveForm.Action = "reglquida.aspx?_codigo=" & Request.QueryString.Item("_codigo").ToString
l.setidpres = Request.QueryString.Item("_codigo")
dt = l.listaletrasxcobrar
If dt Is Nothing Then
__mesajeerror = l.getMensageError
l.CerrarConeccion()
ControlErrores(__mesajeerror, "~/CerrarSession.aspx", "Iniciar sesión")
Else
Dim NroFilas As Integer = dt.Rows.Count
If NroFilas = 0 Then
l.CerrarConeccion()
ControlErrores("No hay letras para cobrar.", "menu.aspx", "Menú")
Else
Dim j As Integer = 0
For i As Integer = 0 To NroFilas - 1
Me.Labelcliente.Text = dt.Rows(i).Item("cliente").ToString
Letra = New System.Web.UI.MobileControls.SelectionList
Letra.SelectType = MobileControls.ListSelectType.CheckBox
Letra.ID = "Letra" & j.ToString
'Letra.EnableViewState = True
'Letra.Wrapping = MobileControls.Wrapping.NoWrap
Dim lista As New System.Web.UI.MobileControls.MobileListItem
lista.Text = CDate(dt.Rows(i).Item("fechacancelar").ToString).ToShortDateString
lista.Value = dt.Rows(i).Item("idletra").ToString
lista.Selected = False
Letra.Items.Add(lista)
'Letra.Items.Add(CDate(dt.Rows(i).Item("fechacancelar").ToString).ToShortDateString)
'Letra.Items.Item(0).Value = dt.Rows(i).Item("idletra").ToString
'Letra.Items(0).Value = dt.Rows(i).Item("idletra").ToString
'Letra.Items(0).Selected = False
'Letra.Items.Item(0).Selected = False
'Letra.Items.Item(0).DataBind()
Me.Panelmenu.Controls.Add(Letra)
'MsgBox(Me.Panelmenu.Controls(i).ID)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "NRO.CUOTA: " & dt.Rows(i).Item("numeroletra").ToString
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Font.Bold = MobileControls.BooleanOption.True
Titulo.Text = "DIAS DEUDA: " & dt.Rows(i).Item("diasinteres").ToString
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "MONTO S/.: " & Format(dt.Rows(i).Item("montoletra"), "###,###.#0")
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "INTERES S/.: " & Format(dt.Rows(i).Item("interes"), "###,###.#0")
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Font.Bold = MobileControls.BooleanOption.True
Titulo.Text = "TOTAL S/.: " & Format(dt.Rows(i).Item("totalpagar"), "###,###.#0")
Me.Panelmenu.Controls.Add(Titulo)
Titulo = New System.Web.UI.MobileControls.Label
Titulo.Alignment = MobileControls.Alignment.Left
Titulo.Text = "****************************"
Me.Panelmenu.Controls.Add(Titulo)
j = j + 1
Letra.Dispose()
Next
Session("numlineas") = (j - 1).ToString
l.CerrarConeccion()
End If
End If
Else
__mesajeerror = l.getMensageError
l.CerrarConeccion()
ControlErrores(__mesajeerror, "CerrarSession.aspx", "Iniciar sesión")
End If
End If
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
End Sub
End Class
Valora esta pregunta
0