1 / 21

ASP.NET CON C SHARP

ASP.NET CON C SHARP. SESION 1: PRIMERA CLASE. es moderno, simple enteramente orientado a objetos Tiene: clases, namespaces, sobrecarga de métodos y manejo de excepciones. SESION 1: PRIMERA CLASE. SESION 1: PRIMERA CLASE. SESION 1: CONFIGURAR.

Télécharger la présentation

ASP.NET CON C SHARP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ASP.NETCON 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 { ///<summary> /// Método que sirve para escribir hola mundo (función) ///</summary> 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“ http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> • <htmlxmlns="http://www.w3.org/1999/xhtml"> • <head runat="server“><title>Página sin título</title> • </head><body> • <% • HolaMundoInicioHolaMundo = new HolaMundo(); • Response.Write(InicioHolaMundo.EscribeHolaMundo()); • %> • </body> • </html>

  11. USAR UNA DLL:

  12. USAR UNA DLL: • usingSystem; • usingSystem.Web; • using Prueba1; • public partial class web_Default2:System.Web.UI.Page{ • protected void Page_Load(object sender,EventArgs e){ • HolaMundoIniciaHolaMundo = new HolaMundo(); • HttpContext.Current.Response.Write(IniciaHolaMundo.EscribeHolaMundo()); } • }

  13. MASTER PAGES

  14. MASTER PAGES • <%@ MasterLanguage="C#" AutoEventWireup="true" CodeFile="MasterPage2.master.cs" Inherits="MasterPage2" %> • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> • <htmlxmlns="http://www.w3.org/1999/xhtml"> • <head runat="server“><title>Página sin título</title> • <asp:ContentPlaceHolderid="head" runat="server"> • Desapareceré • </asp:ContentPlaceHolder> • </head> • <body> • <formid="form1" runat="server"> • <asp:ContentPlaceHolderid="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"> • </asp:Content>

  17. 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

  18. CONTROLES:

  19. CONTROLES:

  20. EJERCICIO 1:

  21. EJERCICIO 1: foreach (string control inRequest.Form) { Response.Write(“<p>” + control + “ “ + Request.Form[control] + “</p>”); }

More Related