Personally, I prefer to create a helper function to insert the appropriate javascript on the page and only pass the parameters of the function, so I donβt have to worry about the messy details every time.
Sort of:
public static void GrowlMessage(System.Web.UI.Control pageControl, string header = "", string message = "", bool sticky = false, string position = "top-right", string theme = "", bool closer = true, int life = 8) { string _js = "$.jGrowl('" + HttpContext.Current.Server.HtmlEncode(message) + "', { header:'" + header + "', sticky:" + sticky.ToString().ToLower() + ", position: '" + position + "', theme: '" + theme + "', closer: " + closer.ToString().ToLower() + ", life:" + life * 1000 + "});"; ScriptManager.RegisterStartupScript(pageControl, pageControl.GetType(),"Growl",_js, true); }
The sample I used also requires jQuery and the jGrowl library available. And IMHO the messages are good. They are unobtrusive, the user does not need to press a button to make them leave, and they disappear after a certain amount of time.
But I agree with Mike that if you donβt have any entries, you should simply use the built-in GridView properties (EmptyDataRowStyle and EmptyDataRowText) to display a message saying βno data matching your requestβ. Assuming you use a gridview in general, this is ..
Rahul source share