Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

jquery - Javascript reg ex need integer between 1 and 999999? -


i wish solve myself, have never quite grasped regular expressions. seem powerful. wanted ask best resource learn javascript reg ex, subjective , didn't want question closed. have textbox on web form, when has value, value should integer between 1 & 999999. use jquery numeric plug in allow digits, other keystrokes rejected, there onblur implementation, if regex not matched, callback called... code...

$.fn.numeric.blur = function() { var decimal = $.data(this, "numeric.decimal"); var callback = $.data(this, "numeric.callback"); var val = $(this).val(); if(val != "") {     var re = new regexp("^\\d+$|\\d*" + decimal + "\\d+");     if(!re.exec(val))     {         callback.apply(this);     } } } 

can modify regex assure val valid integer between 1 , 999999? appreciated. myself, whats easy way learn javascript regex? thank much. have terrific holiday all!

cheers,
~ck in san diego

in particular case, recommend not use regular expression. use plain old javascript:

if( typeof decimal === 'number' && (decimal > 1 && decimal < 999999) ) {      // here go } 

to cast value number, can either use + operator or .parseint()

var val = +$.trim($(this).val()); if( val && (decimal >= 1 && decimal <= 999999) ) { } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -