Posts

Showing posts from January, 2008

ASP.NET: Binding alphabet to dropdown list

Update: Added VB code. There may be some cases where you want a DropDownList to list all the letters in the alphabet (i.e. A - Z). Rather than add the letter individually (through using <asp:ListItem> ) you can create an ArrayList and bind to that. In your ASPX page: <asp:DropDownList ID="Letters" DataSource='<%# Alphabet %>' runat="server" /> In your code behind. Create your Alphabet property: private ArrayList _Alphabet; protected ArrayList Alphabet { get { if (_Alphabet == null) { _Alphabet = new ArrayList(); for (int i = 65; i < 91; i++) { _Alphabet.Add(Convert.ToChar(i)); } } return _Alphabet; } } Protected ReadOnly Property Alphabet() As ArrayList Get If _Alphabet Is Nothing Then _Alphabet = New ArrayList() For i As Integer = 65 To 91 - 1 _Alphabet.Add(Convert.ToChar(i)) Next End If Return _Alphabet End Get End Property Bind on Page_Load: private void Page_Load(object sender

Adding rounded corners to your web pages

There are several ways of adding rounded corners to your web page. There is a large list of methods found at Rounded Corners - css-discuss , but also a few other ways using JavaScript (some using jQuery): The first (as far as I am aware) jQuery corner plugin (Dave Methvin) An improved version (Mike Alsup) of the above plugin curvyCorners - anti-aliased corners, supporting borders and background images A modified version of curvyCorners made to work with jQuery. The above plugin was rather big and couldn't be packed , so someone else made a futher modification that reduced its size and enabled it to be packed. Cornerz - smooth, anti-aliased corners. Another jQuery plugin. Anti-aliased, but does not support backgrounds. Rounded corners using <canvas> . <canvas> is a way of drawing/manipulating images via scripting (e.g. draw vector images, transformation, compositing, animations etc). There is a tutorial available on how to use it. Firefox 1.5+, Opera 9+,