ASP.NET DevConnections '07 - Day 1 - ASP.NET Tips 'n Tricks

Scott Guthrie put on yet another excellent presentation of his ASP.NET 2.0 Tips 'n Tricks.  It always amazes me how technical he is at his position.  He manages hundreds of people and still finds time to communicate with the .net community.  In addition, his communications are anything but fluff and he has an incredible mastery of all things .net related.  It's really quite impressive.  In any case, I'm sure he will post another update to his blog with the slides - which I will re-post here when it happens, but in the mean-time here are the big things he mentioned:

1.  The first item he mentioned was a nice little bit on setting a default button on a page or a panel in the Source View of a page.  The HTML is very simple:

<form defaultbutton="button1">

or, it can also be set in a panel -

<panel defaultbutton="button2">

Perhaps not surprisingly, you can use a similar method to set the default focus to a field on a page.  Just as simply, the syntax is:

<form defaultfocus="textbox1" runat="server">

or

<panel defaultfocus="textbox2" runat="server">

2.  Along that same vein, there's a property on the validators called "setFocusOnError" - which, as you might expect, will set the focus to the field you specify when the validation fails in a validator:

<asp:RequiredFieldValidator id="rfvError" runat="server" setFocusOnError="textbox1".....> 

3.  There's also a scroll method in the page so you can scroll to a particular position on the page.  It's amazing how all these things that we had to write little javascript functions in the past are so simple now.   

4.  Another little tidbit he mentioned - user controls can easily be registered globally in the web.config so that it can be used in any page in your application.  The syntax for the tag is in the web.config is as follows:

<controls>
    <add tagPrefix="acme" tagName="uc" src="...../xxxx.ascx" />
<controls>

What's very cool about this little tip is that once the User Control has been registered in the web.config, the intellisense in the Source view in the Vs.net 2005 IDE immediately picks it up. 

5.  This next one is something that I had actually already known about (and used), but it's still worth mentioning.  The ability to add server-side comments.  Just enter the below text into the Source view on your page and it comments out the text within.  In addition, you can actually high-light your HTML and click the "Comment" icon in the menu-bar and it will insert the server-side comments as well.  The syntax is:

<%--
    Everything in here commented out
--%>

6.  ASP.Net RSS Toolkit - This little toolkit makes VERY easy to bind controls to an RSS feed and render them in a page.  I really can't wait to find a reason to use this one!  ;o) 


There are a few more, but they're a little more complicated to really put into use, so I'll wait for Scott to post everything to his blog and then link back the pertinent items. 

Next will be all the features in the new Orcas release.   Very incredible stuff!
 

Published 27 March 07 07:59 by Greg

Comments

No Comments
Anonymous comments are disabled