Ver Mensaje Individual
  #8 (permalink)  
Antiguo 14/05/2004, 19:04
Avatar de Mickel
Mickel
 
Fecha de Ingreso: mayo-2002
Ubicación: Lima, Peru
Mensajes: 4.619
Antigüedad: 22 años, 10 meses
Puntos: 7
Aca tengo este...

Código PHP:
Imports System
Imports System
.Web
Imports System
.Web.UI
Imports System
.Web.UI.WebControls
Imports System
.ComponentModel
Imports System
.Text
<DefaultProperty("Text"), ToolboxData("<{0}:datebox runat=server></{0}:datebox>")> _
 
Public Class DateBox
    
'Modificado para agregarle Propiedades Locked, VDay, VMonth y VYear
    '
Ademas se le hizo los cambios necesarios solicitados para el Roosevelt.
    
'Y de paso, as usual, le pusimos su imagen para la Toolbox. LMC - 200405
    Inherits System.Web.UI.WebControls.TextBox

    Protected Overrides Sub Render(ByVal output As HtmlTextWriter)
        Dim str_Fecha As String
        MyBase.Attributes.Add("onkeypress", "javascript:TeclaFecha();")
        If Me._Locked Then output.AddAttribute("disabled", "true")
        If Me._VDay > 0 And Me._VMonth > 0 And Me._VYear > 0 Then
            str_Fecha = CType(Me._VDay, String) & "/" & CType(Me._VMonth, String) & "/" & CType(Me._VYear, String)
            output.AddAttribute("value", str_Fecha)
        End If
        output.AddAttribute("style", "cssInput")
        MyBase.Render(output)
        output.AddAttribute("id", Me.ClientID.ToString().Replace("txt", "img") + "NT")
        If Me.Enabled = True Then output.AddAttribute("onclick ", "javascript:AbrirCalendario('" + Me.ClientID.ToString() + "');")
        output.AddAttribute("src", "../RS/Imagenes/bCalendario.gif")
        output.AddAttribute("style", "CURSOR:hand")
        output.RenderBeginTag("IMG")
        output.RenderEndTag()
    End Sub

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        Dim str_Enter As String = Environment.NewLine
        Dim stb_Script As New StringBuilder
        Dim str_Params As String
        str_Params = "vday=" & Me._VDay.ToString & "&vmonth=" & Me._VMonth.ToString & "&vyear=" & Me._VYear.ToString
        With stb_Script
            .Append("<script language='
javascript'>")
            .Append(str_Enter)
            .Append("function AbrirCalendario(control)")
            .Append(str_Enter)
            .Append("{")
            .Append(str_Enter)
            .Append("   var datFecha;")
            .Append(str_Enter)
            .Append("   var objControl;")
            .Append(str_Enter)
            .Append("var winl = (screen.width - 240) / 2; ")
            .Append(str_Enter)
            .Append("var wint = (screen.height - 200) / 2; ")
            .Append("   window.open('
../RS/RS_CalendarioSeleccionar.aspx?")
            .Append(str_Params)
            .Append("
&")
            .Append("
Ctrl=' + control,'winCalendario','width=240px,height=200px,top ' + wint + 'left ' + winl + 'status=no,toolbar=no,scrollbars=no,statusbar=no,resizable=no');")
            .Append(str_Enter)
            .Append("       document.all(control).blur();")
            .Append(str_Enter)
            .Append("}")
            .Append(str_Enter)
            .Append(str_Enter)
            .Append("function TeclaFecha()")
            .Append("{")
            .Append("var sKey;")
            .Append(str_Enter)
            .Append("sKey = String.fromCharCode(window.event.keyCode);")
            .Append(str_Enter)
            .Append("if(!((sKey >= '
0' && sKey <= '9') || (sKey == '/))) {window.event.keyCode 0;} ")
            .Append(str_Enter)
            .Append("
}")
            .Append(str_Enter)
            .Append("
</script>")
        End With
        Dim pg As System.Web.UI.Page
        pg = CType(HttpContext.Current.Handler, System.Web.UI.Page)
        If Not pg.IsClientScriptBlockRegistered("DateBox") Then pg.RegisterClientScriptBlock("DateBox", stb_Script.ToString())
    End Sub

#Region "Private Members"
    Private _VDay As Int32 = 0
    Private _VMonth As Int32 = 0
    Private _VYear As Int32 = 0
    Private _Locked As Boolean = False
#End Region

#Region "Properties"
    Public Property Locked() As Boolean
        Get
            Return Me._Locked
        End Get
        Set(ByVal Value As Boolean)
            Me._Locked = Value
        End Set
    End Property

    Public Property VDay() As Int32
        Get
            Return Me._VDay
        End Get
        Set(ByVal Value As Int32)
            Me._VDay = Value
        End Set
    End Property

    Public Property VMonth() As Int32
        Get
            Return Me._VMonth
        End Get
        Set(ByVal Value As Int32)
            Me._VMonth = Value
        End Set
    End Property

    Public Property VYear() As Int32
        Get
            Return Me._VYear
        End Get
        Set(ByVal Value As Int32)
            Me._VYear = Value
        End Set
    End Property
#End Region
End Class 
__________________
No tengo firma ahora... :(