Descargar la presentación
La descarga está en progreso. Por favor, espere
1
ASP.NET CON C SHARP
2
SESION 1: PRIMERA CLASE es moderno, simple
enteramente orientado a objetos Tiene: clases, namespaces, sobrecarga de métodos y manejo de excepciones.
3
SESION 1: PRIMERA CLASE
4
SESION 1: PRIMERA CLASE
5
SESION 1: CONFIGURAR Para configurar el entorno que vemos podemos acudir a: Herramientas >> Opciones >> Editor de texto >> c#
6
SESION 1: CONFIGURAR
7
SESION 1: PRIMERA CLASE <%@ Page Language="C#“
AutoEventWireup="true“ CodeFile="Default.aspx.cs" Inherits="_Default" %>
8
SESION 1: PRIMERA CLASE
9
SESION 1: PRIMERA CLASE using System; using System.Web;
public partial class _Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { Prueba1.HolaMundo InicioHolaMundo = new Prueba1.HolaMundo(); Response.Write(InicioHolaMundo.EscribeHolaMundo()); } namespace Prueba1 { ///<summary> /// Clase para escribir hola mundo ///</summary> class HolaMundo { /// Método que sirve para escribir hola mundo (función) public string EscribeHolaMundo(){ return "Hola mundo";
10
SESION 1: PRIMERA CLASE Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN“ <html xmlns=" <head runat="server“><title>Página sin título</title> </head><body> <% HolaMundo InicioHolaMundo = new HolaMundo(); Response.Write(InicioHolaMundo.EscribeHolaMundo()); %> </body> </html>
11
USAR UNA DLL:
12
USAR UNA DLL: using System; using System.Web; using Prueba1;
public partial class web_Default2:System.Web.UI.Page{ protected void Page_Load(object sender,EventArgs e){ HolaMundo IniciaHolaMundo = new HolaMundo(); HttpContext.Current.Response Write(IniciaHolaMundo.EscribeHolaMundo()); } }
13
MASTER PAGES
14
MASTER PAGES Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage2.master.cs" Inherits="MasterPage2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " <html xmlns=" <head runat="server“><title>Página sin título</title> <asp:ContentPlaceHolder id="head" runat="server"> Desapareceré </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server“></asp:ContentPlaceHolder> </form> </body></html>
15
CONTENT PAGES:
16
CONTENT PAGES: <%@ Page Language="C#"
MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default__.aspx.cs" Inherits="Default__" Title="Página sin título" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
17
URL REBASING: ES POSIBLE ANIDAR MASTER PAGES
Cuando la Content Page se encuentra en una ubicación distinta lo solucionamos con: Utilizar rutas URL absolutas en la Master Page, por ejemplo <img src=”/myapplication/images/banner.gif” /> Utilizar URLS relativas o URLs relativas de aplicación en los controles de servidor en lugar de marcas estáticas, por ejemplo <asp:Image ImageUrl=”~/images/banner.gif” runat=”server” /> ES POSIBLE ANIDAR MASTER PAGES
18
CONTROLES:
19
CONTROLES:
20
EJERCICIO 1:
21
EJERCICIO 1: } foreach (string control in Request.Form) {
Response.Write(“<p>” + control + “ “ + Request.Form[control] + “</p>”); }
Presentaciones similares
© 2024 SlidePlayer.es Inc.
All rights reserved.