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 - Adding a TimeStamp to Injected Content -


i have along lines of:

by default these panels empty. user actions can populate panels, , users can switch between panels.

the problem have right switching between panels keeps refreshing content server, when it's been loaded, slow ui experience.

i thinking of appending timestamp each of panel divs:

<div id="panel-1" timestamp="13123131313"></div> 

and using timestamp determine if should rehit server, if it's under minute don't, if on minute refresh content.

what i'm looking for:

  1. your thoughts on this?
  2. where can safely store time stamp?
  3. suggestions doing timestamp comparison. simple jquery solutions?

thanks helping me think 1 through.

you accomplish easily—with valid markup—using jquery's .data() method.

something akin this:

// store timestamp on initial ajax load var timestamp = new date().gettime(); $('#panel-1').data('timestamp', timestamp);  // how retrieve last timestamp var last_stamp = $('#panel-1').data('timestamp');  // example of comparing timestamps , setting new 1 var new_timestamp = new date().gettime(),     last_stamp = $('#panel-1').data('timestamp'); if (new_timestamp - last_stamp >= 60000) {     $.ajax({         /* ajax options */         success: function() {             var timestamp = new date().gettime();             $('#panel-1').data('timestamp', timestamp);         }     }); } 

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 -