How to detect Debug mode in JavaScript

I’ve asked a question on forum:

AJAX ScriptManager Class  has a IsDebuggingEnabled property, that is available in server code. I want in my client Javascript function to determine, do I running debug or release mode.

MS Online Community Support suggested :

You can create a hidden field to the page, then, check the IsDebuggingEnabled property of ScriptManager , if it is true, set the value of the hidden field to “true”, else, false.

It will work, but I expected the method available in some AJAX client library class.

Declare different CSS rules for Firefox and Internet Explorer 7

The post Creating different CSS style selector definitions for different browsers (Firefox, Internet Explorer 7 and IE 6.0) with subsequent comments describes that
You can have the same attribute for different browsers in the same rule by specifying # and _ prefix
height: 15px;/* apply to all browsers */
#height: 15px;/
* override for Microsoft Internet Explorer browsers*/
_height: 21px; ;/* override for IE browsers 6.0 and older */
<!–[if gt IE 5]>
<style type=”text/css” media=”screen”>
.idonnyCSS{font-size: 1.3em }
/*The above CSS definitions will only be applies to IE versions greater than 5*/

I prefer the first opton for small changes to keep all definitions for the class/selector in one place.

CSS Filters chart describes “Will the browser apply the rule(s)?”.

More discussion are in

How to use different client AJAX UpdatePanel error handling for different UpdatePanels?

I have an ASP.NET AJAX page with several UpdatePanels. If error occured during asyncronous postback, I want to ignore it for some panels and show errors for other updatepanels. The samples that I found(like  Customizing Error Handling for ASP.NET UpdatePanel Controls.) suggested to call add_endRequest and from EndRequestEventArgs  use error Property  .

 Dave Ward suggested that In EndRequest, you can check sender._panelsToRefreshIDs. It’s a JavaScript array of UpdatePanel IDs being updated in the partial postback

My question on forum is how can I find which of UpdatePanels caused the particular Request in EndRequestHandler?

I found an idea in comments of How to handle a timeout in an async postback to use response Property (Sys.Net.WebRequestExecutor class.) Then I can access webRequest Property , but what to do next?

Jin-Yu Yin from MSFT  suggested to follow these steps:

1. Get which UpdatePanel is updating at the server side. Check these links:

UpdatePanel.IsInPartialRendering Property

Gets a value that indicates whether the UpdatePanel control is being updated as a result of an asynchronous postback.

The IsInPartialRendering property is intended for use by control developers who want to know when an UpdatePanel control is being updated as a result of an asynchronous postback.

Which UpdatePanel issued an Async Postback Call?

how to get which UpdatePanel has posted

2. use try… catch to catch errors, and in catch block, create an new exception which contain information of which updatepanel is updating and throw it.

3. check the information in the error at the client side, process the error based on the information


Why DoPostBackWithOptions didn’t work

I found that one of my ImageButtons stopped sending postback. I’ve noticed that it uses DoPostBackWithOptions.

I remembered, that I had a problem when my page had PopupControlExtender and Validation controls(see.How do I get rid of DoPostBackWithOptions? ), but it was not a case this time.
I’ve checked that it is nothing with IIS setting for handling  “.axd” extensions – checkbox for “Check that File Exists” is unchecked! (see WebForm_ DoPostBackWithOptions not defined ).

Finally I understood that it is extra html form, that I’ve copied from prototype. I had the same issue just 2 week ago-Html Form inside ASP.Net page causes no postbacks

ASP.NET Interview questions

I am involved in hiring an ASP.NET develover for our company. I found a few sites that listed interview questions. Below there are links that I found useful. (thanks to srini) (too complicated)  (some of them are quite good)

On my question about Session State two people answered, that they try to avoid using Sessions because of big memory consumption. IMHO, this should not be considered as major factor for architectural decision, if you need to keep state between pages.

HTML ALT and title attributes -how to specify tooltip

I had a discussion about terminology used to specify tooltip.

That what I found:

ALT=”…”–Specifies a text string to be displayed on browsers that do not support inline images.(from )

Adaping CSS and Javascript from Html Prototype.

I’ve got from web designers HTML prototype, that I have to implement in ASP.NET web site. Just including the whole HTML with CSS and JS files didn’t work well, because the CSS files had global settings, that corrupt existing layout.

So I had to comment and modify CSS selectors to adapt th the site. Not an easy task, because I am not expert in CSS and it took a time to understand quite large set of CSS rules, that the designers used. 

Excellent presentation from Damian Edwards  at RDN about CSS based layout with Visual Studio 2008 came just in time.
The useful lesson: in a class attrubute we can specify more than one space-separated class names
(e.g. cssClass=”navigation active” ) and apply separate rules to each of class names.

A few links that helped me:

CSS2 Specification  Selectors

Top 10 custom JavaScript functions of all time


W3C CSS Validator:

VS 2008 has a few new Designer windows, that help to work with CSS and JS

Firefox handled CSS differently to IE- I need to use Firebug :: Firefox Add-ons to edit, debug, and monitor CSS, HTML, and JavaScript live  -similar to Internet Explorer Developer Toolbar