Matthias Marx wrote:
I need a validation for numeric datatyp.
How could I insert a validation for this. It could be JavaScript,
that onblur - event
With "normal" text boxes I do this
this.txtNumberR ooms.Attributes .Add("onblur",
"javascript:Che ckNumber(this, 4);");
woah there....there' s a much simpler way to do this, and not just within a
DataGrid.
Use a System.Web.UI.W ebControls.Comp areValidator; something like this :
<asp:TextBox id="IntegerValu e" runat="server"/>
<asp:CompareVal idator
ControlToValida te="IntegerValu e"
Operator="DataT ypeCheck"
Type="Integer"
ErrorMessage="- you must provide a valid Integer Value"
Display="Static "
runat="server"/>
The compare validator can check String, Integer, Double, Date or Currency
data types. It also gives you the advantage of performing both client side
*and* server side validation for you. By checking Page.IsValid on postback
you'll know whether or not the data entered is valid according to the rules
you've set up.
With ASP.NET there's really no reason to write your own client-side
validation routines for trivial data-types (and non-trivial ones can usually
be coped with by judicious use of the RegularExpressi onValidator).
HTH,
--
jo inferis