establecer mintime y maxtime de timefield dinámicamente en ext.net
Frecuentes
Visto 650 veces
0
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)??
Código
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.
1 Respuestas
0
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.
Ejemplo
<%@ 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;
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET Examples</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TimeField ID="TimeField1" runat="server" FieldLabel="Time" />
</body>
</html>
Espero que esto ayude
Respondido 30 ago 12, 18:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas asp.net ext.net timefield or haz tu propia pregunta.