User Control
ControlFecha.ascx :
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ControlFecha.ascx.cs" Inherits="WebApplication1.ControlFecha" %>
Dia<asp:TextBox runat="server" ID="txtDia"></asp:TextBox>
Mes<asp:TextBox runat="server" ID="txtMes"></asp:TextBox>
Anio<asp:TextBox runat="server" ID="txtAnio"></asp:TextBox>
-------------------------------------------------------------------------------------------------------
ControlFecha.ascx.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class ControlFecha : System.Web.UI.UserControl
{
public string Dia
{
get
{
return txtDia.Text;
}
set
{
txtDia.Text = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
---------------------------------------------------------------
WebForm1
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<%@ Register TagPrefix="uc" TagName="CntlFecha"
Src="~/ControlFecha.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:CntlFecha runat="server" Dia="01" />
</div>
</form>
</body>
</html>
No hay comentarios:
Publicar un comentario