Jump to content

Recommended Posts

Posted

Boas, eu tenho um uma dropdownlist e com 4 itens a qual a cada um atribui um valor. e gostava de passar essa valor para um modulo e como sou novo com o Web developer e nesta linguagem não estou a conseguir.

Posted

A dropdown pertence à página, por isso não terás acesso diretamente de outro sitio.

O que pretendes fazer exactamente no modulo?

Podes é chamar uma função do modulo e passas por parametro o valor selecionado da dropdown

Posted

A DropDown tem 4 itens: DT's Professores Alunos e Enc. Edu a qual tem o valor 0,1,2 e 3 respectivamente associados. Depois queria passar um desses valores dependendo do tipo de acesso escolhido para depois no modulo fazer a consulta certa a tabela na BD.

o Codigo no ASPX é o seguinte:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="PaginaLogin.aspx.vb" Inherits="PAPWEB.PaginaLogin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>

<script runat="server">

    Private Sub SaberAcesso()

	    If Ddl.SelectedItem.Value = 0 Then
		 lblPass.Visible = True
		 lblTurma.Visible = True
		 lblUser.Visible = True
		 txbPass.Visible = True
		 txbUser.Visible = True
		 Label1.Visible = True
		 btnLogin.Visible = True
		 tbxTurma.Visible = True

	 Else
		 lblPass.Visible = True
		 lblTurma.Visible = False
		 lblUser.Visible = True
		 txbPass.Visible = True
		 txbUser.Visible = True
		 tbxTurma.Visible = False
		 Label1.Visible = False
		 btnLogin.Visible = True


	 End If
    End Sub

    </script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  <p>
   Escolha o tipo de acesso que pretende ter:
  <asp:DropDownList ID="Ddl" runat="server" >
   <asp:ListItem Text ="Diretor de Turma" Value ="0"></asp:ListItem>
   <asp:ListItem Text="Professor" Value="1"></asp:ListItem>
   <asp:ListItem Text="Aluno" Value="2" ></asp:ListItem>
   <asp:ListItem Text="Enc. Educação" Value="3"></asp:ListItem>
   </asp:DropDownList>
   <asp:Button ID="bttEscolher" runat="server" Text="Escolher" onclick="SaberAcesso" />
  </p>

   <p>
 <asp:Label ID="lblUser" runat="server" Text="Utilizador:"></asp:Label>
 <asp:Textbox ID="txbUser" runat="server" ></asp:Textbox>
   </p>
   <p>
   <asp:Label ID="lblPass" runat="server" Text="Password:"></asp:Label>
   <asp:Textbox ID="txbPass" runat="server" ></asp:Textbox>
   </p>
   <p>
    <asp:Label ID="lblTurma" runat="server" Text="Turma:"></asp:Label>
    <asp:TextBox ID="tbxTurma" runat="server"></asp:TextBox>
      
    <asp:Label ID="Label1" runat="server" Text="Ex: 12º8"></asp:Label>
   </p>
   <asp:Button ID="btnLogin" runat="server" Text="Entrar" onclick="SaberAcesso" />

</asp:Content>

Peço desculpa se estou a cometer erros basicos mas estou masi habituado ao Visual Basic e asp nao pesco muito.

Posted

Ele nao me reconhece o modulo na parte do ASPX

eu pois coisa tipo isto

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="PaginaLogin.aspx.vb" Inherits="PAPWEB.PaginaLogin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>

<script runat="server">

    Private Sub SaberAcesso()

	    If Ddl.SelectedItem.Value = 0 Then
		 lblPass.Visible = True
		 lblTurma.Visible = True
		 lblUser.Visible = True
		 txbPass.Visible = True
		 txbUser.Visible = True
		 Label1.Visible = True
		 btnLogin.Visible = True
		 tbxTurma.Visible = True

	 Else
		 lblPass.Visible = True
		 lblTurma.Visible = False
		 lblUser.Visible = True
		 txbPass.Visible = True
		 txbUser.Visible = True
		 tbxTurma.Visible = False
		 Label1.Visible = False
		 btnLogin.Visible = True


	 End If
dim x as integer = Ddl.selecteditem.value
acesso(x)
    End Sub

    </script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  <p>
   Escolha o tipo de acesso que pretende ter:
  <asp:DropDownList ID="Ddl" runat="server" >
   <asp:ListItem Text ="Diretor de Turma" Value ="0"></asp:ListItem>
   <asp:ListItem Text="Professor" Value="1"></asp:ListItem>
   <asp:ListItem Text="Aluno" Value="2" ></asp:ListItem>
   <asp:ListItem Text="Enc. Educação" Value="3"></asp:ListItem>
   </asp:DropDownList>
   <asp:Button ID="bttEscolher" runat="server" Text="Escolher" onclick="SaberAcesso" />
  </p>

   <p>
 <asp:Label ID="lblUser" runat="server" Text="Utilizador:"></asp:Label>
 <asp:Textbox ID="txbUser" runat="server" ></asp:Textbox>
   </p>
   <p>
   <asp:Label ID="lblPass" runat="server" Text="Password:"></asp:Label>
   <asp:Textbox ID="txbPass" runat="server" ></asp:Textbox>
   </p>
   <p>
    <asp:Label ID="lblTurma" runat="server" Text="Turma:"></asp:Label>
    <asp:TextBox ID="tbxTurma" runat="server"></asp:TextBox>
      
    <asp:Label ID="Label1" runat="server" Text="Ex: 12º8"></asp:Label>
   </p>
   <asp:Button ID="btnLogin" runat="server" Text="Entrar" onclick="SaberAcesso" />

</asp:Content>

Acesso está no modulo como public sub e mesmo assim nao da

Posted

Tens um ficheiro chamado ModuloAcesso.vb, correcto?

Se abrires o ficheiro, o que tens na primeira linha? Não é algo do tipo "Module ModuloAcesso" ?

Tens a sub acesso dentro desse modulo, correcto?

Posted

Sim e o codigo no Modulo é o seguinte

Imports System.Data.SqlClient
Module ModuloAcesso
   Public ligacao As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Jorge\Desktop\LivroPonto\LivroPonto\PAPSQL_DADOS.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
   Public Sub Acesso()
   End Sub
End Module

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.