我第一次使用海关检查员,但似乎没有发射日期。 服务器仪表和刚在Click行动中操作该代码。
现在,我好好几小时! 谁能看一看问题做什么?
The DropDownList in my Code below is populationed using Roles.Get AllRoles()
ASP. NET
<asp:Label ID="lUserRole" runat="server" AssociatedControlID="tUserRole">User Role:</asp:Label>
<asp:DropDownList ID="tUserRole" runat="server" CausesValidation="True">
</asp:DropDownList>
<asp:Label ID="lDateExpire" runat="server" AssociatedControlID="tDateExpire">Date Expire:</asp:Label>
<asp:TextBox ID="tDateExpire" runat="server"></asp:TextBox>
<asp:CustomValidator ID="DateExpireRequired" runat="server"
ControlToValidate="tDateExpire" ErrorMessage="Date Expire is required for Users ." OnServerValidate="DateExpireRequired_ServerValidate"
ToolTip="Date Expire is required for Users ." CssClass="frmError"></asp:CustomValidator>
CODE BEHIND
Sub DateExpireRequired_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs)
If tUserRole.SelectedValue = "User" Then
If tDateExpire.Text <> "" Then
args.IsValid = False
Else
args.IsValid = True
End If
Else
args.IsValid = True
End If
End Sub
感谢J。