establecer mintime y maxtime de timefield dinámicamente en

I am working with EXT.NET 1.2 I want to set minTime and maxTime from codebehind(from cs Page).

I ha dwritten following code but not working that code.. is their any mistake or is ther any another method(through Javascript)??


tmFrom.Increment = 30;
string strmin = obj.startTime.ToShortTimeString();
DateTime dtmin = DateTime.ParseExact(strmin, "H:mm tt", CultureInfo.InvariantCulture);
string strmax = obj.endTime.ToShortTimeString();
DateTime dtmax = DateTime.ParseExact(strmax, "H:mm tt", CultureInfo.InvariantCulture);
tmFrom.Format = "H:mm";
tmFrom.MinTime = dtmin.TimeOfDay;
tmFrom.MaxTime = dtmax.TimeOfDay;

I am setting minTime and maxTime from Database value.

preguntado el 28 de agosto de 12 a las 08:08

1 Respuestas

Based on your code sample, it appears obj.startTime y obj.endTime are both already DateTime objects. You should not have to convert into Strings, then back into DateTime objects.

The following sample demonstrates the complete scenario.


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
        var startTime = DateTime.Now.AddMinutes(-215);
        var endTime = DateTime.Now.AddMinutes(215);
        var time = this.TimeField1;

        time.Increment = 30;
        time.Format = "H:mm";
        time.MinTime = startTime.TimeOfDay;
        time.MaxTime = endTime.TimeOfDay;

<!DOCTYPE html>

<head runat="server">
    <title>Ext.NET Examples</title>
    <ext:ResourceManager runat="server" />

    <ext:TimeField ID="TimeField1" runat="server" FieldLabel="Time" />

Espero que esto ayude

Respondido 30 ago 12, 18:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.