asp.net con c sharp. septiembre 2010 sesion 1: primera clase es moderno, simple enteramente...
Post on 21-Feb-2015
6 Views
Preview:
TRANSCRIPT
ASP.NETCON C SHARP
Septiembre 2010
SESION 1: PRIMERA CLASE•es moderno, simple
•enteramente orientado a objetos
•Tiene: clases, namespaces, sobrecarga de métodos y manejo de excepciones.
Septiembre 2010
SESION 1: PRIMERA CLASE
Septiembre 2010
SESION 1: PRIMERA CLASE
Septiembre 2010
SESION 1: CONFIGURAR
Para configurar el entorno que vemos podemos acudir a:Herramientas >> Opciones >> Editor de texto >> c#
Septiembre 2010
SESION 1: CONFIGURAR
Septiembre 2010
SESION 1: PRIMERA CLASE
<%@ Page
Language="C#“
AutoEventWireup="true“
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
Septiembre 2010
SESION 1: PRIMERA CLASE
Septiembre 2010
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 { ///<summary> /// Método que sirve para escribir hola mundo (función) ///</summary> public string EscribeHolaMundo(){ return "Hola mundo"; } }}
SESION 1: PRIMERA CLASE
Septiembre 2010
SESION 1: PRIMERA CLASE
Septiembre 2010
USAR UNA DLL:
Septiembre 2010
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()); }
}
Septiembre 2010
MASTER PAGES
Septiembre 2010
MASTER PAGES
Septiembre 2010
CONTENT PAGES:
Septiembre 2010
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">
</asp:Content>
Septiembre 2010
URL REBASING: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
Septiembre 2010
CONTROLES:
Septiembre 2010
CONTROLES:
Septiembre 2010
EJERCICIO 1:
Septiembre 2010
EJERCICIO 1:foreach (string control in Request.Form) {
Response.Write(“<p>” + control + “ “ + Request.Form[control] + “</p>”);
}
top related