February 2008 Entries

Trace option for ASP.NET control will be useful to inspect event sequence.

Sometimes to understand sequence of events in ASP.NET page, it is useful to set @page TRACE="true" It shows(among other details) the sequence of page events and time that took each event to execute. However you can't request the same trace facility for user control events. You have to insert your own Trace.WriteLine (or similar) statements, which is quite annoying. I've posted the suggestion to MS Feedback site, but they do not want to implement it. Related articles that describe events and events ......

Function to get parent GridView for GridViewRow

A reference to the GridView can be obtained by using gridViewRow.Parent.Parent or (GridView) gridViewRow.NamingContainer... from here). So I've created the static function: public static GridView GetParentGridView(GridViewRow row) { //NOTE row.Parent doesn't return GridView GridView gridView = (GridView)row.NamingContainer; return gridView; } ......

Visual Studio Editor doesn't provide interface to create Event Handlers in ASP.NET Web Pages

Visual Studio has an article How to: Create Event Handlers in ASP.NET Web Pages, But you can't select the page object in Design view to specify events in Properties. In code-behind pages that use C#, because the control name will not appear in the drop-down list. It seems that C# event handler for page can be created only manually!? According to VS2008 help, the new version has no improvement in this area. Why C# editor doesn't have control drop-down list on the left top corner, as VB editor has ......

Min and Max methods for DateTime

Math.Max Method doesn't have overload for DateTime So I've created public static DateTime Min(DateTime t1, DateTime t2) { if (DateTime.Compare(t1, t2) > 0) { return t2; } return t1; } public static DateTime Max(DateTime t1, DateTime t2) { if (DateTime.Compare(t1, t2) < 0) { return t2; } return t1; } ......

Reduce use of HTTPS protocol as much as possible

I've noticed that some pages on our site were opened from my home computer with huge delay --more than 30sec, but others- almost instantly. The problem was with pages that use HTTPS(SSL protocol). It seams that my internet provider had performance problem, but it had huge impact on pages that was opened using SSL. In the normal development/test environment we never noticed the problem, but it could be a big issue for users with low bandwidth. We need to redesign our application to use https protocol ......

Visual Studio new item wizard generates ambiguous class names

When I added a new Master page in Visual Studio 2005, named as MyApp.Master, the generated class was named just MyApp. I've already have a namespace with the same name MyApp, and it caused the compiler errors. It will be good if new file wizard by default create class names, that include the type of generated object, e.g. MyAppMaster class. Similar should be apply for other ASP.NET objects, e.g. Customer.aspx page should use CustomerPage class, and Customer.ascx user control should use CustomerUsc ......

Differences in Internet Explorer and FireFox CSS and Javascript

I've done quite a few web UI changes, including CSS styles and javascript testing in IE. Now I have to ensure, that it also work in FioreFox. The suggested Collection of Global CSS Reset Styles not always work , if site has already some default style settings. See my recent post how to Declare different CSS rules for Firefox and Internet Explorer 7 . parentElement I also incorrectly used parentElement in DOM - always use parentNode instead. innerText Thanks to Damian Edwards who pointed another FireFox ......

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 ......

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 .context_bar_form_field { height: 15px;/* apply to all browsers */ #height: 15px;/* override for Microsoft Internet Explorer browsers*/ _height: 21px; ;/* override for IE browsers 6.0 and older */ } Alternatively you can use Conditional ......

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 ......

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 ......

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. http://srini-aspnet-tour.bl... (thanks to srini) http://www.hanselman.com/bl... (too complicated) http://www.hanselman.com/bl... http://www.megasolutions.ne... ......

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 http://www.htmlgoodies.com/... ) Alt text is an alternative, not a tooltip- see http://www.456bereastreet.c... The alt and title attributes- see http://www.456bereastreet.c... ......

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 ......

«February»
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678