Jump to content


Photo

Asp E Poo


  • Faça o login para participar
Nenhuma resposta neste tópico

#1 Maracuja

Maracuja

    12 Horas

  • Usuários
  • 144 posts
  • Sexo:Não informado

Posted 14/10/2005, 08:26

Bom, primeiro me desculpem por repetir isso, mas é que parece que ninguem deu importância!!! vcs entemdem o poder que a POO (Programamção Orientada a Objetos) oferece para nós desenvolvedores ASP!!!! Eu ainda utilizo muito pouco isso... mais é mto interessante!!! o que vc acharam???

Neste você encotrara um exemplo de como programar ASP orientado a objeto...

Bem o exemplo realiza uma padronização de formularios em uma web.

Para aproveitar, ou mesmo, entender o que estou fornecendo...você de conhecer a sintaxe ASP e tambem sobre SSI e Classes de Objeto... Veja abaixo:

##########################################################
A Class...
##########################################################


<% Option Explicit %>

<%
Class GeraFormulario

Public Sub FormInicio(metodo,para,nome,id)

Response.Write "<form method="""& metodo &""" action="""& para &""" name="""& nome &""" id="""& id &""">"

End Sub



Public Sub FormTabelaInicio(borda,corborda,cortabela,larguratabela,nome,id)

Response.Write "<table border="""& borda &""" cellpadding=""0"" cellspacing=""0"" style=""border-collapse: collapse"" bordercolor="""& corborda &""" width="""& larguratabela &""" id="""& id &""">"

End Sub

Public Sub FromTabelaFim()

Response.Write "</table>"

End Sub

Public Sub FormLinha(TituloLinha,Nomeobjform,Tipo,Tamobjform)

Response.Write "<tr>"
Response.Write "<td width='200' style='border-style: solid; border-width: 0' align='right'><font face='Microsoft Sans Serif' size='1'> "& TituloLinha &"</font></td>"
Response.Write "<td width='200' style='border-style: solid; border-width: 0' align='left'><font face=""Microsoft Sans Serif"" size=""1""><input type="& Tipo &" name="& Nomeobjform &" size="& Tamobjform &"></font></td>"
Response.Write "<td width='20' style='border-style: solid; border-width: 0' align='center'><font face=""Microsoft Sans Serif"" size=""1""> </font></td>"
Response.Write "<td width='20' style='border-style: solid; border-width: 0' align='center'> </td>"
Response.Write "<td width='85' style='border-style: solid; border-width: 0' align='left'> </td>"
Response.Write "</tr>"

End Sub

Public Sub FormButton(Nome,Valor,Tipo,Texto)

Response.Write "<tr>"
Response.Write "<td width='200' style='border-style: solid; border-width: 0' align='right'><font face='Microsoft Sans Serif' size='1'> </font></td>"
Response.Write "<td width='200' style='border-style: solid; border-width: 0' align='left'><font face=""Microsoft Sans Serif"" size=""1""> </font></td>"
Response.Write "<td width='20' style='border-style: solid; border-width: 0' align='center'><font face=""Microsoft Sans Serif"" size=""1""><button name="""& Nome &""" value="""& Valor &""" type="""& Tipo &""">"& Texto &"</button></font></td>"
Response.Write "<td width='20' style='border-style: solid; border-width: 0' align='center'> </td>"
Response.Write "<td width='85' style='border-style: solid; border-width: 0' align='left'> </td>"
Response.Write "</tr>"

End Sub

Public Sub FormFim()

Response.Write("</Form>")

End Sub

End Class
%>
#########################################################
A página com o SSI da Class....
#########################################################

<style type="text/css">
#todoform input
{
font-family: Microsoft Sans Serif;
font-size: 10 px;
color: #000080;
text-transform: uppercase;
border-style: solid;
border-width: 1;
background-color: #FFFFFF
}
table#formulario tr.linhapergunta
{
border-left-style: none;
border-left-width: medium;
border-right-style: none;
border-right-width: medium;
border-top-style: none;
border-top-width: medium;
margin-left:0;
margin-right:0
}

</style>
<%
Dim ObjFormulario

Set ObjFormulario = New GeraFormulario

Dim x

ObjFormulario.FormInicio "Post","PrintFolheto.asp","meuform","todoform"
ObjFormulario.FormTabelaInicio "0","","","500","tabela1","formulario"

'Criando as linhas da tabela



ObjFormulario.FormLinha "Nome da Agencia 1:","NomeObj1","text","40"
ObjFormulario.FormLinha "Nome da Agencia 2:","NomeObj2","text","40"
ObjFormulario.FormLinha "Nome da Agencia 3:","NomeObj3","text","40"
ObjFormulario.FormButton "BtnAdd","AddAgencia","Submit","Adicionar"

ObjFormulario.FromTabelaFim
ObjFormulario.FormFim

Set ObjFormulario = Nothing
%>


#########################################################
Página Imprimir Folheto
#########################################################

<%

Response.Write (Request.Form("NomeObj1")) &"<br>"
Response.Write (Request.Form("NomeObj2")) &"<br>"
Response.Write (Request.Form("NomeObj3")) &"<br>"

%>
<script> print();</script>




Tenha bom proveito...
Pergunte e Comente...


Fabio Braga
Itip Internet Business


vejam aki tb

Mais +++++++++++++++++++=
------------------------
Agora ainda mais Java na veia (JSP, Servlet, EJB)

"E todo o dinheiro que fizeram, jamais comprará de volta suas almas" BOB DYLAN

"Eu uso o google e não desisto nunca" MARACUJA




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq