Override the Standard Status Bar Message of the DataGrid
page 1 of 5
Published: 20 Sep 2005
Unedited - Community Contributed
Organizations that are concerned with website security may want to prevent a browser's status bar from displaying link addresses. This is particularly true for ASP.NET controls such as the DataGrid, where the status bar will reveal the ID values of child link controls. Steven Archibald demonstrates how to override the status bar message for DataGrid link controls, and discusses some standard link behavior that cannot be prevented.
by Steven Archibald
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 23406/ 89


Many organizations, financial institutions in particular, do not like the standard behavior of web browsers and web controls. Such organizations may have the first page of their website be a 'hidden' page that pops up the main page of the application with certain browser elements removed. Many choose to remove the status bar, the tool bar, and the address bar.  In the web application on which I am currently working, the client has chosen to leave the status bar visible, but to override the message presented in the status bar. For a web page using straight HTML controls, this is fairly easy to do by simply adding code to the onmouseover and onmouseout event parameters of an HTML element.

But what if you are using a DataGrid control that contains a LinkButton control? When the user's mouse hovers over a link in the DataGrid, they will see a status message similar to the following:


As you can see, this displays the control's ID within the parentheses. This could be considered a security risk. When you choose a DataGrid column to be a sort column, ASP.NET generates the header text for the column as a link button. So, when the user's mouse hovers over the header text in the sort column, they see a status bar message similar to the one above.

So, we need a way to override the standard status bar message. This article will show how to do this in the code-behind for the page. Incidentally, the technique I document below can be modified for use in other situations.

Furthermore, there is some standard behavior for a link that apparently cannot be overridden. I will demonstrate this behavior as well.  It may be possible to override this standard behavior as well, but every link I have tested has behaved with the same shortcomings.

View Entire Article

User Comments

Title: Solution to 'Unpreventable' standard behavior   
Name: Your Daddy
Date: 2007-01-04 12:30:26 PM
The javascript "onfocus" event for the anchor element can be used to get rid of that pesky status bar message that displays when you hold the left mouse button down. In addition to using onmouseover, onmousedown, onmouseup, onmouseout, etc, add an onfocus attribute to the anchor element.


Your Daddy
Title: self.status doesn't work in Firefox   
Name: slolife
Date: 2005-10-17 7:53:59 PM
self.status='Hello' doesn't work in Firefox. Is this a security/anti phishing thing?
Title: Mr   
Name: Abdul Salam
Date: 2005-10-12 12:23:38 AM
very good Thanks
Title: Link is always visible   
Name: kraftspl
Date: 2005-09-23 6:45:18 PM
Nice work, but the referenced link is always visible in the status bar, when you click a link. You will furthermore see a status message.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-05-29 11:16:14 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search