开发者

Best way to display & fade out a status message in asp.net?

I am using VSS 2005 & webforms with AJAX Control Toolkit. I am using Update panels for saving different p开发者_运维百科arts of my form. Problem being I update the user with the status setting either a label or literal value.

This value is visible on the form untill the page is refreshed. Is there any way to display a message and fade it away after some seconds ? Would be a life saver for me =)

I am using VSS 2005 but I don't think a simple fade would require much intellisense with JQuery ?


With a combination of the jQuery timers plugin and the jQuery fadeOut method, you might achieve what you want:

$(function() {
    $(this).oneTime(1000, function() {
        $('#book').fadeOut('slow', function() {
        // Animation complete.
        });
    });
});

This will call a function after the DOM is ready (first line). This function will call another function after one second (second line). This other function will fade out the item with id 'book'.

The DOM might not be 'finished' with updatepanels, I don't know. You could just make this a normal function (replace the first line with function removeMessage() { and the last line with }. Then in your updatePanel, add a call to this function. I haven't tested this myself, though.


I developed a simple light-weight control that you can just drag-n-drop and show "twitter style" flash messages.

http://dotnetkicks.com/aspnet/ASP_NET_SlidingMessage_Control

Please vote if you find it useful :)

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜