Welcome to DevAuthority.Com Sign in | Join | Help

I'm leaving you DA

Sorry guys of DA but I'm leaving you. I got a new blog set up on DotNetSlackers and choose to keep that one only.

Keep up the good work here at DevAuthority, I'm not leaving you because I didn't like staying here. Here we don't have advertisements, the blog is customizable in its appearance and some other nice things, but I chose to switch to DNS despite the advertisements and the inability of customize the blog's appearance because I love them since it's my primary source of information and secondly because it focuses directly on ASP.NET, which is the topic I mostly write about.

Please update your links, the new blog address is http://dotnetslackers.com/community/blogs/simoneb


posted by SimoneB | 2 Comments

ATLAS UpdateProgressSignup: get a notification of UpdatePanel's events

This blog has moved to DotNetSlackers, please update your links and post comments there.

One of the most asked questions on the ATLAS forums - one I asked myself just yesterday - is about how to get a notification when the UpdatePanels in the page perform their asynchronous postback to the server and moslty when they return their results.
If the UpdateProgress control does its work pretty well allowing to display a message during partial updates, someone may be interested in performing some custom actions when those events fire.

I don't want to delve into the mechanisms by which ATLAS performs its asynchronous calls and how the UpdateProgress subscribes to those events, for which I redirect you to the ATLAS forum, where it has been discussed largely like in this post.
Since the current ATLAS CTP doesn't provide us with an easy way of doing that I have created a server control which exposes two properties, which in turn accept the names of two Javascript functions you can write in your page and which are called respectively when the UpdatePanels initiate the postback and when the results are returned.

You can find more details and the download links here.

The AssociatedControlID property of the Label web control

This blog has moved to DotNetSlackers, please update your links and post comments there.

In ASP.NET 2.0 the Label web control exposes a new property, AssociatedControlID, which takes the ID of another control in the page, that is, a TextBox or another input control.
When the property is set, the rendering of the Label switches from a simple <span> tag to a <label> tag, whose for attribute assumes the client-side ID of the associated control as the value.

A sample to clear things up

<asp:label ID="Label1" runat="server" Text="Label" />
<asp:TextBox
ID="TextBox1" runat="server" />

becomes:

<span id="Label1">Label</span>
<
input name="TextBox1" id="TextBox1" type="Text" />

While

<asp:label ID="Label1" AssociatedControlID="TextBox1" runat="server" Text="Label" />
<asp:TextBox
ID="TextBox1" runat="server" />

becomes:

<label for="TextBox1" id="Label1">Label</label>
<
input name="TextBox1" id="TextBox1" type="Text" />

The difference

The difference is an accessibility feature. Setting the AssociatedControlID property any click on the Label extends to the associated control. In case of an associated TextBox the effect is that when clicking on the Label the TextBox gains focus.

posted by SimoneB | 2 Comments
Filed Under:

A ScriptAculoUs autocomplete web control

This blog has moved to DotNetSlackers, please update your links and post comments there.

UPDATE: 05/07/06: Added a property - ScrollSize - which allows to show the results in a scrolled fashion.
UPDATE: 24/06/06: Fixed the bug affecting Firefox and published sources.
UPDATE: 27/06/06: Now it can be embedded into a UserControl and can retrieve the values from a UserControl method.

ScriptAculoUs is a top quality JavaScript library, useful for everything related to client-side web programming, like effects, DOM programming, events and so on.
Recently they included a new "control" in the package, which is able to extend a normal HTML input text into an autocomplete control. Does this reminds you of the ATLAS autocomplete extender? Read on...
The word "control" is not the same as the one ASP.NET programmers are used to hear, since it now refers to a client-side behavior, which happens completely on the client.
This autocomplete control, whom you can see examples here, is very rich in features but not very developer-friendly from an ASP.NET developer point of view, because almost everything has to be programmed in the markup code and manually, so I decided to create a custom control to wrap all those functionalities in a simple to use component called ScriptAculoUs.Net.

But why is this better than the other thousand autocomplete controls available out there?
Well, first let me make a brief list of the ones I like most:
  • ATLAS Autocomplete extender: very cool, but you need a webservice to retrieve results.
  • UPDATE 17/06/06: ATLAS Smart Autocompletion: a textbox built on top of ATLAS framework which incorporates the ATLAS autocomplete extender into a reusable web control, and enhances it by allowing to retrieve the suggestion list from a page method other than the classic web service method.
  • Wilco Bauer's SmartTextBox: very well written webcontrol, source code is a must-see, but lacks client-side support.
  • AspItalia TextBox Autocomplete: a must see too, can retrieve results from a DataSource control!

Ok, these are the coolest out there. My control can be better because:

  • ScriptAculoUs is a client-side library, has great support for visual effects and the result is better than all of them;
  • ScriptAculoUs is cross-browser, they mostly aren't;
  • ScriptAculoUs is a continuous work in progress, it will improve and I won't have to care about it unless they change the API.

To sum it up, this is better because ScriptAculoUs preserves me from caring about the client-side programming, which is the most part in an autocomplete pattern.

Features

  • No need for a web service or an external page to retrieve the suggestions, just a page method, which has to be public, return an object implementing the IEnumerable interface and accept a string as input parameter (the typed keys).
  • The support for effects, key navigation and anything else related to client-side behaviors is great thanks to ScriptAculoUs.
  • The results are cached on the client.
  • Can be easilly configured to show an animated image next to it just using a simple property. The image shows up when the control is retrieving the results from the server and hides when the operation is complete.
  • Can be extended to use a AutocompleteProgress control, also shipped, which can be placed anywhere on the page and customized using templates, which makes its content visible when the main control is retrieving results and makes them invisible when the callback is complete. For those using ATLAS, this is the same as the UpdateProgress control.
  • You can choose how many chars are needed to be typed before the control performs a callback to the server. The default value is 1.
  • The list of results appearance can be customized using some style properties called Suggestionxxx and SelectedSuggestionxxx. Easy to use.

I welcome any feedback and suggestion to improve it. A screencast about how to set it up is available too. Please watch it at double speed since it was recorded on a slow virtual machine, otherwise you risk to fall asleep :-)

Download

Binaries: ScriptAculoUs.Net.bin.zip

Sources: ScriptAculoUs.Net.src.zip

Screencast: ScriptAculoUs.Net Demo.wmv

Misc resources for ASP.NET

This blog has moved to DotNetSlackers, please update your links and post comments there.

  • ASP.NET Property Grid, a cool ASP.NET web control.
  • NUnitASP, unit testing for ASP.NET.
  • RSSBus, interconnection to its limits!
  • YUI, the new version of YAHOO! User Interface Library is out, with so many new features is absolutely to see.
  • http://www.aspdotnet.sk, free ASP.NET 2.0 hosting with SQLE, 3rd level domain and FTP access, guess the only one in the world - aspspider.net is free too but doesn't offer domain name and FTP access. Paid hosting too but very cheap. No details about reliability but it worth trying.
  • Design resources for ASP.NET

    This blog has moved to DotNetSlackers, please update your links and post comments there.

    I just wanted to publish a link listing of very good resources for designing ASP.NET and non-ASP.NET websites. Includes some CSS related content.

    posted by SimoneB | 1 Comments
    Filed Under:

    Customize control properties depending on the browser in ASP.NET 2.0

    This blog has moved to DotNetSlackers, please update your links and post comments there.

    ASP.NET 2.0 has a nice, not much known feature which lets designer customize controls properties declaratively according to the browser requesting the page.

    Let's suppose that we want to show a different Text value of a Label control depending on whether the request is coming from IE or Firefox. Then we'll just have to write something like this in the webform:

    <asp:Label ID="Label1" runat="server" Text="Rendered in default browser" 
            
    ie:Text="Rendered in IE"
            
    mozillafirefox:Text="Rendered in Firefox">
    <
    /asp:Label>

    I'm pretty sure that anyone would find something more useful to apply this feature to :-)

    The available browser IDs can be found in the directory %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\CONFIG\Browsers
    posted by SimoneB | 2 Comments
    Filed Under:

    Release 0.2.0 of BusyBoxDotNet

    This blog has moved to DotNetSlackers, please update your links and post comments there.

    The new version of BusyBoxDotNet is now available.

    This is a major release with some nice new features. Take a test drive using the online demo page and download binaries, sources and demo from Sourceforge.

    Template merging with NVelocity and ASP.NET

    This blog has moved to DotNetSlackers, please update your links and post comments there.

    Some time ago I wrote an article for CodeProject about merging templates with NVelocity.

    For those who don't know what template merging means, think about a newsletter management system which needs to send emails to website users.
    Website admins may need to customize the messages according to user info, that is, greeting the user with a "Hello [username]" or something like that, and have message templates easy to mantain, maybe keeping them on the file system as html pages or creating them dinamically in the code of the application.

    How would you do this by hand? Don't think too much, use NVelocity!

    In the article I develop a library which greatly eases the use of NVelocity in ASP.NET applications, as well as in any other type of .NET projects.

    You can read the article as well as download source code and demo files here: Template merging with NVelocity and ASP.NET

    First Post | BusyBoxDotNet

    This blog has moved to DotNetSlackers, please update your links and post comments there.

    Hi everyone, my name's Simone and I'm an Italian developer.

    This is my first post here on DevAuthority, although I used to post in my own language at UgiDotNet, the Italian .NET User Group, for a quite while. 

    I will primarily post about ASP.NET, C# and data persistence, the topics I use to work on in my everyday life.

    You may be wondering what BusyBoxDotNet is. It is an ASP.NET web control library I have developed and released open source in the last months. It can be used to show a message to website users during long processing tasks occuring on the server, informing them that something is actually happening there.

    Any info can be found at http://busybox.sourceforge.net.

    Any feedback is welcome!

    posted by SimoneB | 2 Comments
    Filed Under: ,