c# - Make javascript continue to play after redirect -
im using visual studio 2013. coding in .net c#.
my projekt cms im using master page.
on content pages got save button. when pressing load javascript class code:
contentpage
protected void btnsave_click(object sender, eventargs e) { sys.enigma.message m = new sys.enigma.message(); m.infomessage("post updated", 5, master.page); }
class
public class message { public void infomessage(string text, int seconds, page page) { seconds = seconds * 1000; text = "<div class='e-info-message'>" + text + "</div>"; page.clientscript.registerstartupscript(gettype(), "load", "<script type=text/javascript> var x = document.getelementbyid('e-info-message'); x.innerhtml = \"" + text + "\"; settimeout(function() { $('.e-info-message').fadeout('slow');}, " + seconds + "); if (ispostback){$('.e-info-message').show();} </script>"); } }
what happends display div green background "post update" in it. automaticly fades out after 5 seconds. if redirect user other page or user clicks other link in cms div dissapears.
i want div visible x seconds if page redirecting or user clicking other links inside cms.
ive been searching , trying loads of stuff 2 days without getting work. working example non redirect / user clicking link.
anyone has idea how work way want to?
Comments
Post a Comment