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.

javascript - checking for an array in an multidimensional array (pref-jQuery) -


i've got multi-dimensional array, , i'm trying check if holds array. i'm using jquery.inarray function @ moment (i trying array.prototype kept getting errors, never used before).

i trying ensure parent array doesn't add same child array twice

 if(jquery.inarray(new array(step[0],step[1],r2),unavailarray)==-1){     alert(jquery.inarray(new array(step[0],step[1],r2),unavailarray));      unavailarray.push(new array(step[0],step[1],r2));   }  

i've tried

 jquery.inarray("[step[0],step[1],r2]",unavailarray)==-1 

and

 jquery.inarray([step[0],step[1],r2],unavailarray)==-1 

they return -1, , when @ array, have

 [[630,690,09],[3180,3220,2],[3180,3220,2]] 

so isn't working.

i believe you're issue keep adding new array() arrays instead of giving them variable name point to, hence they're never same though may have same exact content each other.

for work wish need assign new array([step[0],step[1],r2]) variable , check variable instead of new array()

var blah = new array(step[0],step[1],r2);  // add array unavailarray if(jquery.inarray(blah,unavailarray)==-1){     alert(jquery.inarray(blah,unavailarray));      unavailarray.push(blah);   }else{     alert('found not added'); }  // try again , wont, instead firing off alert message if(jquery.inarray(blah,unavailarray)==-1){     alert(jquery.inarray(blah,unavailarray));      unavailarray.push(blah);   }else{     alert('found not added'); } 

here link jsfiddle made illustrate this: live example


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 -