CustomValidator OnServerValidate时不时 不进事件,丫的 哪位高手有高见!小弟跪求
CustomValidator OnServerValidate时不时 不进事件,丫的 谁有高见!小弟跪求。
[align=left]example:
------解决方案--------------------
fuck u too!
[align=left]example:
- HTML code
<asp:TextBox ID="_defineTextBox" runat="server" Width="40px" /> <asp:CustomValidator ID="_defineTextValidator" runat="server" ControlToValidate="_defineTextBox" OnServerValidate="Define_OnServerValidate" Display="Dynamic" ErrorMessage="Must be between 0.00% and 100.00%." ForeColor="Red" SetFocusOnError="True" ToolTip="0.00%-100.00%" >*</asp:CustomValidator>
- C# code
protected void Define_OnServerValidate(object source, ServerValidateEventArgs args) { bool valid = true; decimal output = -1.0M; if (!string.IsNullOrWhiteSpace(args.Value)) { var amount = args.Value.Replace(CurrencyTye, ""); var value = decimal.TryParse(amount, out output) ? output : -1.0M; if (value < 0M || value > 100.00M) valid = false; else valid= true; } args.IsValid = valid; }
------解决方案--------------------
fuck u too!