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

CheckBox

Estas en el tema de CheckBox en el foro de .NET en Foros del Web. Hola amigos! Tengo varios checkbox en un web form y necesito almacenar los valores de sus etiquetas (Text) en un registro de la bd. Como ...
  #1 (permalink)  
Antiguo 05/07/2006, 20:27
 
Fecha de Ingreso: mayo-2005
Mensajes: 274
Antigüedad: 19 años
Puntos: 0
CheckBox

Hola amigos! Tengo varios checkbox en un web form y necesito almacenar los valores de sus etiquetas (Text) en un registro de la bd. Como puedo hacer eso?

Gracias!
  #2 (permalink)  
Antiguo 06/07/2006, 08:52
Avatar de AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 23 años, 2 meses
Puntos: 535
¿cómo que "los valores de sus etiquetas"? Los checkboxes no tienen etiquetas... ¿o si?

Podrías poner un poquito de tu código y decir exactamente cuál es la parte que querés almacenar en la bd?
__________________
...___...
  #3 (permalink)  
Antiguo 06/07/2006, 12:56
 
Fecha de Ingreso: mayo-2005
Mensajes: 274
Antigüedad: 19 años
Puntos: 0
Ok! Observa el codigo:

Dim strRecopInformacion As String
If ckbRecopInfo.Checked = True Then
strRecopInformacion = CType(ckbRecopInfo.Text.ToLower, String)
End If

Dim strInterpNum As String
If ckbInterpNum.Checked = True Then
strInterpNum = CType(ckbInterpNum.Text.ToLower, String)
End If

Dim strJuicio As String
If ckbjuicio.Checked = True Then
strJuicio = CType(ckbjuicio.Text.ToLower, String)
End If

Dim strCapCrit As String
If ckbcapcrit.Checked = True Then
strCapCrit = CType(ckbcapcrit.Text.ToLower, String)
End If

Dim strCreatividad As String
If ckbcreatividad.Checked = True Then
strCreatividad = CType(ckbcreatividad.Text.ToLower, String)
End If

Dim strPerspectiva As String
If ckbplanificación.Checked = True Then
strPerspectiva = CType(ckbplanificación.Text.ToLower, String)
End If

Dim strConscOrg As String
If ckbconscorg.Checked = True Then
strConscOrg = CType(ckbconscorg.Text.ToLower, String)
End If

Dim strConEnt As String
If ckbcondelentorno.Checked = True Then
strConEnt = CType(ckbcondelentorno.Text.ToLower, String)
End If

Dim strOrientacion As String
If ckborientaprend.Checked = True Then
strOrientacion = CType(ckborientaprend.Text.ToLower, String)
End If

Dim strAnalProb As String
If ckbInterpNum.Checked = True Then
strAnalProb = CType(ckbanalproble.Text.ToLower, String)
End If

Dim strNingunoCompInt As String
If ckbninguno.Checked = True Then
strNingunoCompInt = CType(ckbninguno.Text.ToLower, String)
End If

'Dim strCompIntel As String = strRecopInformacion & "," & strInterpNum & "," & _
'strCompIntel & "," & "strJuicio & "," & strCapCrit & "," & "," & strPerspectiva & _
'strConscOrg & "," & strConEnt & "," & strOrientacion & "," & strAnalProb & strNingunoCompInt

Tengos todos estos ckeck y necestio almacenar los posibles valores correspondientes a los mismos que puedan ser seleccionados por x usuarios en la BD. Entiendes?...Como puedo hacer eso?

Intente declarando una variable de tipo string por cada check y luego anidarlas todas para guardarlas en una sola, pero no me parece la forma más adecuada.

Existira una forma más efectiva de hacerlo?
  #4 (permalink)  
Antiguo 06/07/2006, 15:43
Avatar de RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 22 años, 2 meses
Puntos: 50
podrías hacerlo de ésta forma:


Cita:
Dim sbSQL As New System.Text.StringBuilder
...
...
If ckbRecopInfo.Checked Then
sbSQL.Append(ckbRecopInfo.Text.ToLower)
End If
If ckbInterpNum.Checked Then
sbSQL.Append(ckbInterpNum.Text.ToLower)
End If
If ckbjuicio.Checked Then
sbSQL.Append(ckbjuicio.Text.ToLower)
End If
...
...
y con sbSQL.ToString() obtienes todo el texto

por cierto, ya no necesita el casting a string ya que por default Text es un string

Salu2
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net
  #5 (permalink)  
Antiguo 06/07/2006, 21:39
 
Fecha de Ingreso: mayo-2005
Mensajes: 274
Antigüedad: 19 años
Puntos: 0
Muchas gracias amigo!
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 20:50.