January 2007 - Posts
Put this in the location bar of your web browser :
javaFOOscript:document.body.contentEditable='true'; document.designMode='on'; void 0
(due to security on my blog, please remove the FOO string)
Now you can tweak and test your design, change text, resize pictures, resize tables, ... so it's easy to review your layout live with your customer during a meeting, deface a website you hate or... just having fun!
Go ahead, test this and play with my blog!
I'm happy to hear that the next VS ASP.NET designer will be huge!
It will fix some stuff and bring nice value additions to the poor actual VS2005 one :
- Split View Support (the ability to have both HTML Source and WYSIWYG design open simultaneously)
- Extremely rich CSS support (CSS property window, CSS inheritance viewer, CSS preview, and CSS manager)
- Dramatically improved view switching performance (moving from source->html design mode is now nearly instantaneous)
- Designer support for nested master pages : this is a must-have, and certainly the main reason why nobody use nested MasterPage (and yes, I know, solution exist but...)
Please read more on Scott Guthrie's blog entry :
Visual Studio "Orcas" Web Designer Integrated into Main
Thomas Deml has published a very nice and quick tip on how to optimize your default web page :
How to speed up your most popular web page
Quick and so useful : I like this kind of tip!
I've just noticed that a new beta version of the Internet Explorer Developer Toolbar is available! Not yet final but I like this Web Developer tool. No more toolbar menu in IE but a shortcut button instead, which open the bottom panel, the menu is inside this one now (but I think toolbar will be back again soon, or at least as an option).
Despite all the cool things in it I advise people NOT to install this version as it is far for stable and some features simply crash.
If you still want to try it, don't forget to uninstall previous beta versions.
Still in beta but it comes with enhancements over previous versions, including:
- Style Tracer: Right mouse click on a style value for an element and select Style Tracer to find the style rule that is effecting that value.
- CSS Selector Matches: View a report of all style rules set and how many times they are used on the current page.
- View Source: View the formatted and syntax colored source of the original page, currently rendered page, element or element with the styles that are effecting it.
What is it?
In case you don't know this IE extension, here is the official description:
"The Microsoft Internet Explorer Developer Toolbar provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages. This version is a preview release and behavior may change in the final release."
It works with Windows Vista and IE7 (and XP/IE6 too) and add lot's of great features :
- Explore and modify the document object model (DOM) of a Web page.
- Locate and select specific elements on a Web page through a variety of techniques.
- Selectively disable Internet Explorer settings.
- View HTML object class names, ID's, and details such as link paths, tab index values, and access keys.
- Outline tables, table cells, images, or selected tags.
- Validate HTML, CSS, WAI, and RSS Web feed links.
- Display image dimensions, file sizes, path information, and alternate (ALT) text.
- Immediately resize the browser window to a new resolution.
- Selectively clear the browser cache and saved cookies. Choose from all objects or those associated with a given domain.
- Choose direct links to W3C specification references, the Internet Explorer team weblog (blog), and other resources.
- Display a fully featured design ruler to help accurately align and measure objects on your pages.
- Find the style rules used to set specific style values on an element.
- View the formatted and syntax colored source of HTML and CSS.
Where is it?
You can download this free tool there :
Words from the Microsoft team : "There’s lots more we hope to provide for the developer toolbar in future versions and all your ideas are welcome."
For me the killer feature would be a live CSS replacement panel, like the one in Firefox Web Developer Toolbar, with it you can edit your CSS on-the-fly without the need to edit/save/reload/repeat.
If you too have feedback or suggestions go to the Developer Toolbar Wiki on Channel 9 :
Can't wait for the final release!
You've deployed your app in prod server, you run it on the browser and you get an exception:
Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
|An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
[NullReferenceException: Object reference not set to an instance of an
Context context, String virtualPath, Boolean failIfNoData,
Boolean pageMethods) +378
Script(HttpContext context, IPage page, Boolean debug) +45
System.Web.UI.ScriptManager.RegisterServices() +728 System.Web.
EventArgs e) +244
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +2012740
oreAsyncPoint, Boolean includeStagesAfterAsyncPoint)+1566
It happens when your site use ASP.NET AJAX RC in a VS 2005 Web Site Project and you deploy with "publish web site" or "web deployment project" utility with checkbox "allow the site to be updatable" unchecked.
It's a bug from ASP.NET AJAX RC1 and will be fixed in next version.
Until this you can make everything work fine if you precompile with checkbox "allow this site to be updatable" checked.
The problem is you can't add breakpoint in your Js code "This is not a valid location for a breakpoint." on VS 2005 unless you move it to an external Js file.
Dan Walhin made a good video tutorial where he shows us every steps needed to debug client side script :
Video : Debugging ASP.net Ajax Application with Visual Studio 2005
Basically, you have to tweak IE to enable client script debugging :
Go to Tools > Internet Options > Advanced and uncheck both "Disable script debugging (Internet Explorer)" and "Disable script debugging (Other)" .
Then in your client code use debug.fail() Microsoft AJAX method to launch debugging, and as you have the message "There is no source code available for the current location", use the Script Explorer window (Debug > Windows > Script Explorer) to get a list of all loaded Js scripts, then you can select one, debug and step-in your client code and also into the AJAX Framework!
But... no way for me to make it work with Visual Studio 2005 on Vista (and file system web app) !
So if you are stuck like me maybe you'll need to do more work :
- Install Visual Studio 2005 SP1
- Install Visual Studio 2005 SP1 Update for Windows Vista Beta
You also need to start Visual Studio 2005 with admin privilege (right click VS shortcut "Run as administrator").
Chances are now you'll be able to hit F5 and step through your client code in VS (if not go to the link at the end of this post).
Later I found a very good article from Mike Volodarsky which describe a lot more on the subject, specially if you are using IIS :
Fix problems with Visual Studio F5 debugging of ASP.NET applications on IIS7 Vista
These days I was working on a web app dealing with large amount of data.
When it comes to display these data we use GridView and enable pagination in one click.
First thing to know is by default ASP.NET 2.0 GridView default paging is very poor in terms of performance because it first gets all data from db, and then trims the results to render the current page. And it does the same when you change to next page and the others!
Note that it was the same problem with ASP.NET 1.x DataGrid, then you had to implement custom paging to make things smart, that means getting only data that you need to display if you have multiple pages in your grid.
With ASP.NET 2.0 you can very easily use custom paging, without writing a line of code behind!
Scott Mitchell wrote a very good article on how to implement this using the SQL Server 2005 new ROW_NUMBER() keyword and configuring your Object Data Source properly :
Custom Paging in ASP.NET 2.0 with SQL Server 2005
Problem is my current app is using SQL Server 2000...
But chance is Greg Hamilton wrote a very nice tutorial to do the same in SQL Server 2000 using the SET ROWCOUNT command :
A More Efficient Method for Paging Through Large Result Sets in SQL Server 2000
One more thing on the same idea of performance, many people, when creating primary key/foreign key relationships for joigning tables forget that while an index is automatically created on the primary key column, an index for a foreign key IS NOT automatically created, and must be created manually if needed. That could help if your paging's query use JOIN clauses.
And the final touch, now that we have Top efficient SQL work, we can move the GridView inside an ASP.NET AJAX UpdatePanel and let users navigate through data without PostBack!
Quick and Smart !
If you have 1 min and VS already opened, just try this :
The definitive Coder's Happy New Year.
I have been blog-tagged by Etienne, so I need to list 5 personnal things. Easy for me to tell 5 things others may not know about me as... few people know me !
- I was born and grow up in France. I like travelling and I'm fond of outdoor sports, here is a list of sports I've been practicing a part in my life: climbing, golf, baseball, ice-skating, sky-diving, paragliding, roller-skating, rink-hochey, skiing, skateboarding, snowboarding, funboarding, kayaking, archery, judo. Next on the list are
skidoo and dog sledding (done!).
- I discovered and browsed my first website in 1995 and never stopped exploring the web since then. I realized very early that web technologies will rule my life. In 2003 I had the chance to discover ASP.NET in Bewise and learnt so much there!
- Then in summer 2006 I sold everything and moved to canada "To see something else" with my girlfriend, 2 bags and no idea what we will found.
- I found the process of starting again from the beginning very exciting !
- I'm a real bilboquet (cup-and-ball) Champion!
(sure I could be in the Guinness book)
Let's make this tag-thing cross the ocean... I'm tagging Laurent Kempé, Cyril and Sonu.
[Update: after one winter in Quebec I've now done skidoo and dog sledding, next!]
My name is Laurent Duveau and I'm a .NET developer in Montréal, Canada.
What a surprise this morning for the very first day of the year... I was awarded MVP by Microsoft !!!
2007 couldn't start better for me !
So now I'm proud to have a blog here and I hope to create original content. There are 75 feeds in my RSS reader and I don't want to create "just one more". Therefore I will not post very often, only when I have something really interesting to share (I hope so).
Here you'll find content that I focus on through my day to day job, mainly .NET web development technologies :
- ASP.NET 2.0, 3.x
- ASP.NET AJAX
- Windows Live
- Windows Vista