A ver si te sirve...
Esto seria el ascx
Código PHP:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="uc_Hora.ascx.vb" Inherits="uc_Hora" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:DropDownList id="ddl_Hora" runat="server" CssClass="cssInput" AutoPostBack="True"></asp:DropDownList>
<asp:TextBox id="txt_Interval" runat="server" Width="8px" Height="8px" Visible="False">5</asp:TextBox>
<asp:TextBox id="txt_ILimitM" runat="server" Visible="False" Height="8px" Width="8px">0</asp:TextBox>
<asp:TextBox id="txt_ILimitH" runat="server" Visible="False" Height="8px" Width="8px">0</asp:TextBox>
<asp:TextBox id="txt_SLimitM" runat="server" Visible="False" Height="8px" Width="8px">59</asp:TextBox>
<asp:TextBox id="txt_SLimitH" runat="server" Visible="False" Height="8px" Width="8px">23</asp:TextBox>
<asp:TextBox id="txt_Valor" runat="server" Visible="False" Height="8px" Width="8px"></asp:TextBox>
y esto seria el codebehind. Perdon por la chambonada, pero esto lo hice cuando recien empezada con VB.NET y, bueno, como hasta ahora funciona...
Código PHP:
Public Class uc_Hora
Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents ddl_Hora As System.Web.UI.WebControls.DropDownList
Protected WithEvents txt_Interval As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_ILimitM As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_ILimitH As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_SLimitM As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_SLimitH As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_Valor As System.Web.UI.WebControls.TextBox
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
#Region "Propiedades"
Public Property Intervalo() As Int32
Get
If Not IsNumeric(txt_Interval.Text) Then txt_Interval.Text = "1"
Return CType(txt_Interval.Text, Int32)
End Get
Set(ByVal Value As Int32)
If Value > 60 Then Value = 60
Me.txt_Interval.Text = Value.ToString
PopulateHora()
End Set
End Property
Public Property LimiteInferior() As String
Get
Return Me.txt_ILimitH.Text & ":" & Me.txt_ILimitM.Text
End Get
Set(ByVal Value As String)
Me.txt_ILimitH.Text = Left(Value, 2).Valor.ToString
If CType(Me.txt_ILimitH.Text, Int32) < 0 Then Me.txt_ILimitH.Text = "0"
If CType(Me.txt_ILimitH.Text, Int32) >= 24 Then Me.txt_ILimitH.Text = "23"
Me.txt_ILimitM.Text = Right(Value, 2).Valor.ToString
If CType(Me.txt_ILimitM.Text, Int32) < 0 Then Me.txt_ILimitM.Text = "0"
If CType(Me.txt_ILimitM.Text, Int32) >= 60 Then Me.txt_ILimitH.Text = "59"
End Set
End Property
Public Property LimiteSuperior() As String
Get
Return Me.txt_SLimitH.Text & ":" & Me.txt_SLimitM.Text
End Get
Set(ByVal Value As String)
Me.txt_SLimitH.Text = Left(Value, 2).Valor.ToString
If CType(Me.txt_SLimitH.Text, Int32) < 0 Then Me.txt_SLimitH.Text = "0"
If CType(Me.txt_SLimitH.Text, Int32) >= 24 Then Me.txt_SLimitH.Text = "23"
Me.txt_SLimitM.Text = Right(Value, 2).Valor.ToString
If CType(Me.txt_SLimitM.Text, Int32) < 0 Then Me.txt_SLimitM.Text = "0"
If CType(Me.txt_SLimitM.Text, Int32) >= 60 Then Me.txt_SLimitH.Text = "59"
End Set
End Property
Public Property Valor() As String
Get
txt_Valor.Text = ddl_Hora.SelectedItem.Value
Return txt_Valor.Text
End Get
Set(ByVal Value As String)
txt_Valor.Text = Value
'SeleccionaValorDropDownList es una funcion que permite setear un valor a un DropDownList
SeleccionaValorDropDownList(ddl_Hora, txt_Valor.Text)
End Set
End Property
Public Property Habilitado() As Boolean
Get
Return ddl_Hora.Enabled
End Get
Set(ByVal Value As Boolean)
ddl_Hora.Enabled = Value
End Set
End Property
#End Region
Public Event Hora_Changed()
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Put user code to initialize the page here
If Not Page.IsPostBack Then
PopulateHora()
If Len(txt_Valor.Text) > 0 Then SeleccionaValorDropDownList(ddl_Hora, txt_Valor.Text)
End If
End Sub
Private Sub PopulateHora()
ddl_Hora.Items.Clear()
Dim num_I As Int32, num_J As Int32, num_Interval As Int32, num_Max As Int32
num_Interval = CType(txt_Interval.Text, Int32)
For num_I = CType(txt_ILimitH.Text, Int32) To CType(txt_SLimitH.Text, Int32)
If num_I = CType(txt_ILimitH.Text, Int32) Then
num_J = CType(txt_ILimitM.Text, Int32)
Else
num_J = 0
End If
If num_I = CType(txt_SLimitH.Text, Int32) Then
num_Max = CType(txt_SLimitM.Text, Int32)
Else
num_Max = 59
End If
Do While num_J <= num_Max
ddl_Hora.Items.Add(num_I.ToString.PadLeft(2, "0") & ":" & num_J.ToString.PadLeft(2, "0"))
num_J = num_J + num_Interval
Loop
Next
End Sub
Private Sub ddl_Hora_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl_Hora.SelectedIndexChanged
RaiseEvent Hora_Changed()
End Sub
End Class
ojala te sirva y si lo mejoras... pasalo, pues...