Custom-Validator eingefügt.
This commit is contained in:
@@ -105,12 +105,14 @@
|
|||||||
<div class="col-12" id="container2" style="margin-left:2px;">
|
<div class="col-12" id="container2" style="margin-left:2px;">
|
||||||
<asp:Label ID="lbl_von" runat="server" Text="Von:"></asp:Label>
|
<asp:Label ID="lbl_von" runat="server" Text="Von:"></asp:Label>
|
||||||
<asp:TextBox id="pickdate1" Type="Date" CssClass="classTarget" requiered="true" runat="server"></asp:TextBox>
|
<asp:TextBox id="pickdate1" Type="Date" CssClass="classTarget" requiered="true" runat="server"></asp:TextBox>
|
||||||
<!--<asp:RequiredFieldValidator ID="RequiredFieldValidatorvon" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate1" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator>
|
<asp:CustomValidator runat="server" ID="valDateRange_1" ControlToValidate="pickdate1" onservervalidate="valDateRange_1_ServerValidate" ErrorMessage="enter valid date" />
|
||||||
|
<!--<asp:RequiredFieldValidator ID="RequiredFieldValidatorvon" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate1" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator>
|
||||||
<asp:CustomValidator ValidateEmptyText="false" ClientValidationFunction="instantValidation"></asp:CustomValidator> -->
|
<asp:CustomValidator ValidateEmptyText="false" ClientValidationFunction="instantValidation"></asp:CustomValidator> -->
|
||||||
<asp:Label ID="lbl_bis" runat="server" Text="Bis:"></asp:Label>
|
<asp:Label ID="lbl_bis" runat="server" Text="Bis:"></asp:Label>
|
||||||
<!-- <asp:RequiredFieldValidator ID="RequiredFieldValidatorbis" ClientValidationFunction="validate" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate2" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator> -->
|
<!-- <asp:RequiredFieldValidator ID="RequiredFieldValidatorbis" ClientValidationFunction="validate" runat="server" ErrorMessage="Field required" ControlToValidate="pickdate2" Text="Required" ForeColor="White" Font-Strikeout="False" Font-Underline="False" Font-Overline="False" Font-Bold="True" BackColor="Red"></asp:RequiredFieldValidator> -->
|
||||||
<asp:TextBox id="pickdate2" Type="Date" CssClass="classTarget" required="true" runat="server"></asp:TextBox>
|
<asp:TextBox id="pickdate2" Type="Date" CssClass="classTarget" required="true" runat="server"></asp:TextBox>
|
||||||
</div>
|
<asp:CustomValidator runat="server" ID="valDateRange_2" ControlToValidate="pickdate2" onservervalidate="valDateRange_2_ServerValidate" ErrorMessage="enter valid date" />
|
||||||
|
</div>
|
||||||
<div id="Abstand"></div>
|
<div id="Abstand"></div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|||||||
@@ -16,41 +16,60 @@ Partial Class Kundenbereich_Default
|
|||||||
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
||||||
Page.UnobtrusiveValidationMode = UnobtrusiveValidationMode.WebForms
|
Page.UnobtrusiveValidationMode = UnobtrusiveValidationMode.WebForms
|
||||||
DataBind()
|
DataBind()
|
||||||
tbl_Header_row.TableSection = TableRowSection.TableHeader
|
tbl_Header_row.TableSection = TableRowSection.TableHeader
|
||||||
' MsgBox(datebis)
|
' MsgBox(datebis)
|
||||||
If (Page.IsPostBack And normaltable.EnableViewState = False) Then
|
If (Page.IsPostBack And normaltable.EnableViewState = False) Then
|
||||||
normaltable.EnableViewState = True
|
normaltable.EnableViewState = True
|
||||||
If rbt_Alle.Checked = True Then
|
If rbt_Alle.Checked = True Then
|
||||||
lbl_von.Visible = True
|
lbl_von.Visible = True
|
||||||
lbl_bis.Visible = True
|
lbl_bis.Visible = True
|
||||||
pickdate1.Visible = True
|
valDateRange_1.Enabled = True
|
||||||
pickdate2.Visible = True
|
valDateRange_2.Enabled = True
|
||||||
ElseIf rbt_Alle_M.Checked = True Then
|
|
||||||
lbl_von.Visible = True
|
|
||||||
lbl_bis.Visible = True
|
|
||||||
pickdate1.Visible = True
|
pickdate1.Visible = True
|
||||||
pickdate2.Visible = True
|
pickdate2.Visible = True
|
||||||
ElseIf rbt_Freig.Checked = True Then
|
ElseIf rbt_Freig.Checked = True Then
|
||||||
lbl_von.Visible = True
|
lbl_von.Visible = True
|
||||||
lbl_bis.Visible = True
|
lbl_bis.Visible = True
|
||||||
pickdate1.Visible = True
|
valDateRange_1.Enabled = True
|
||||||
pickdate2.Visible = True
|
valDateRange_2.Enabled = True
|
||||||
ElseIf rbt_Freig_M.Checked = True Then
|
|
||||||
lbl_von.Visible = True
|
|
||||||
lbl_bis.Visible = True
|
|
||||||
pickdate1.Visible = True
|
pickdate1.Visible = True
|
||||||
pickdate2.Visible = True
|
pickdate2.Visible = True
|
||||||
Else
|
Else
|
||||||
lbl_von.Visible = False
|
lbl_von.Visible = False
|
||||||
lbl_bis.Visible = False
|
lbl_bis.Visible = False
|
||||||
|
valDateRange_1.Enabled = False
|
||||||
|
valDateRange_2.Enabled = False
|
||||||
|
pickdate1.Visible = False
|
||||||
|
pickdate2.Visible = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
If rbt_Alle_M.Checked = True Then
|
||||||
|
lbl_von.Visible = True
|
||||||
|
lbl_bis.Visible = True
|
||||||
|
valDateRange_1.Enabled = True
|
||||||
|
valDateRange_2.Enabled = True
|
||||||
|
pickdate1.Visible = True
|
||||||
|
pickdate2.Visible = True
|
||||||
|
ElseIf rbt_Freig_M.Checked = True Then
|
||||||
|
lbl_von.Visible = True
|
||||||
|
lbl_bis.Visible = True
|
||||||
|
valDateRange_1.Enabled = True
|
||||||
|
valDateRange_2.Enabled = True
|
||||||
|
pickdate1.Visible = True
|
||||||
|
pickdate2.Visible = True
|
||||||
|
Else
|
||||||
|
lbl_von.Visible = False
|
||||||
|
lbl_bis.Visible = False
|
||||||
|
valDateRange_1.Enabled = False
|
||||||
|
valDateRange_2.Enabled = False
|
||||||
pickdate1.Visible = False
|
pickdate1.Visible = False
|
||||||
pickdate2.Visible = False
|
pickdate2.Visible = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
datevon = Date.Parse(pickdate1.Text)
|
datevon = Date.Parse(pickdate1.Text)
|
||||||
datebis = Date.Parse(pickdate2.Text)
|
datebis = Date.Parse(pickdate2.Text)
|
||||||
Else
|
Else
|
||||||
normaltable.EnableViewState = True
|
normaltable.EnableViewState = True
|
||||||
Dim erster = New Date(Now().Year, Now().Month, 1)
|
Dim erster = New Date(Now().Year, Now().Month, 1)
|
||||||
Dim ersterdat = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
Dim ersterdat = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
||||||
pickdate1.Text = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
pickdate1.Text = erster.Day.ToString + "." + Now().Month.ToString + "." + Now().Year.ToString
|
||||||
@@ -459,5 +478,22 @@ Partial Class Kundenbereich_Default
|
|||||||
pickdate2.BorderStyle = BorderStyle.None
|
pickdate2.BorderStyle = BorderStyle.None
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
Protected Sub valDateRange_1_ServerValidate(source As Object, args As ServerValidateEventArgs)
|
||||||
|
Dim minDate As DateTime = DateTime.Parse("01.04.2001")
|
||||||
|
Dim maxDate As DateTime = DateTime.Parse(DateTime.Now.ToShortDateString)
|
||||||
|
Dim dt As DateTime
|
||||||
|
|
||||||
|
args.IsValid = (DateTime.TryParse(args.Value, dt) AndAlso
|
||||||
|
dt <= maxDate AndAlso
|
||||||
|
dt >= minDate)
|
||||||
|
End Sub
|
||||||
|
Protected Sub valDateRange_2_ServerValidate(source As Object, args As ServerValidateEventArgs)
|
||||||
|
Dim minDate As DateTime = DateTime.Parse("01." + Date.Now.Month.ToString + ".2001")
|
||||||
|
Dim maxDate As DateTime = DateTime.Parse(DateTime.Now.ToShortDateString)
|
||||||
|
Dim dt As DateTime
|
||||||
|
|
||||||
|
args.IsValid = (DateTime.TryParse(args.Value, dt) AndAlso
|
||||||
|
dt <= maxDate AndAlso
|
||||||
|
dt >= minDate) And dt < Date.Now.AddDays(-1)
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
@@ -152,8 +152,14 @@ hr{
|
|||||||
background-color:salmon;
|
background-color:salmon;
|
||||||
border: 1px solid red;
|
border: 1px solid red;
|
||||||
}
|
}
|
||||||
@media (max-width: 558.98px) {
|
#pickdate1:valid{
|
||||||
h1 {
|
color:black;
|
||||||
|
}
|
||||||
|
#pickdate1:invalid{
|
||||||
|
border: 1px solid red;
|
||||||
|
}
|
||||||
|
@media (max-width: 558.98px) {
|
||||||
|
h1 {
|
||||||
color: #043381;
|
color: #043381;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user