Ver Mensaje Individual
  #6 (permalink)  
Antiguo 11/08/2011, 13:41
Darkrox
 
Fecha de Ingreso: julio-2011
Mensajes: 15
Antigüedad: 12 años, 9 meses
Puntos: 0
Respuesta: DropDownList en GridView

No se si te refieras a este, ya que no se mucho de esto
Así es como carga, yo solo apoyo en el proyecto, así que prefiero no meterle mucha mano de obra a lo brusco
Código vb:
Ver original
  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.         Dim i As Integer
  3.         Dim Accesos As DataSet
  4.         If Session("sec_sesion") <> 1 Then
  5.             Dim mensaje2 As String = "<script language='javascript'> alert('Debe iniciar sesion'); location.href = 'Inicio.aspx'; </script>"
  6.             ClientScript.RegisterStartupScript(Page.GetType(), "msj", mensaje2)
  7.         Else
  8.             Accesos = Permisos.Permiso("Administracion.aspx", Session("sec_grupo"))
  9.             If Accesos.Tables("acceso").Rows.Count = 0 Then
  10.                 Dim mensaje As String = "<script language='javascript'> alert('Acceso denegado a esta página'); location.href = 'Inicio.aspx'; </script>"
  11.                 ClientScript.RegisterStartupScript(Page.GetType(), "msj", mensaje)
  12.             Else
  13.                 For i = 0 To Accesos.Tables("acceso").Rows.Count - 1
  14.                     If (Accesos.Tables("acceso").Rows(i).Item(0).ToString <> 3) Then
  15.                         Me.TabContainer1.ActiveTabIndex = 0
  16.                         Me.TabContainer1.Tabs(0).Visible = False
  17.                         Me.TabContainer1.Tabs(1).Visible = False
  18.                         Me.TabContainer1.Tabs(2).Visible = False
  19.                         Me.TabContainer1.Tabs(3).Visible = True
  20.                         If Accesos.Tables("acceso").Rows(i).Item(1).ToString <> 8 Then
  21.                             enable_serv()
  22.                         End If
  23.                         Me.TabContainer1.Tabs(4).Visible = False
  24.                         Me.TabContainer1.Tabs(5).Visible = False
  25.                         Me.TabContainer1.Tabs(6).Visible = False
  26.                         If Session("sec_iddepto") = 34 Then
  27.                             Me.TabContainer1.Tabs(7).Visible = True
  28.                         Else
  29.                             Me.TabContainer1.Tabs(7).Visible = False
  30.                         End If
  31.                         Me.TabContainer1.Tabs(8).Visible = False
  32.                     End If
  33.                 Next
  34.             End If
  35.         End If
  36.     End Sub

Y para registrar los datos a la Base es este
Código vb:
Ver original
  1. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  2.         Try
  3.             Catalogos.RegDir(Me.txtnomb.Text, Me.txtalias.Text, Me.DDLTit.Text)
  4.             ScriptManager.RegisterStartupScript(Me.UpdatePanel1, Me.UpdatePanel1.GetType(), "Catálogos", "alert('Registro Agregado');", True)
  5.             'Conexion.closeCon()
  6.            Me.txtnomb.Text = ""
  7.             Me.txtalias.Text = ""
  8.             Me.DDLTit.Text = ""
  9.         Catch ex As Exception
  10.             ScriptManager.RegisterStartupScript(Me.UpdatePanel1, Me.UpdatePanel1.GetType(), "Catálogos", "alert('" & ex.Message.ToString & "');", True)
  11.         End Try
  12.     End Sub
Código vb:
Ver original
  1. Public Shared Function RegDir(ByVal Nom_dir As String, ByVal Alia As String, ByVal tipo As String) As String
  2.         Dim conection As SqlConnection = Conexion.GetConnection
  3.         Dim sqlquery As String = "exec pc_NewDir '" & Nom_dir & "','" & Alia & "','" & tipo & "'"
  4.         Dim comando As SqlCommand = New SqlCommand(sqlquery, conection)
  5.         comando.ExecuteNonQuery()
  6.         conection.Close()
  7.         Return 0
  8.     End Function