Nov 20 2008

ASP.NET DropDownList and null value (or nullable database field)

Classified in: ASP.NETpaomic at 12:41 pm

If you have an ASP.NET detailsview or similar control, you may already have added extended control, such as radiobuttonlists or dropdowns. If so, you may have experienced and error when you use such controls binded to a database field which is nullable, and has a null value. In this case, the bind fails. To avoid this error, simply add a list item to the collection of the dropdownlist, like this:

<asp:ListItem Selected=”True” Value=”">Nessuna</asp:ListItem>

Add the AppendDataBoundItems property to the dropdownlist:

asp:DropDownList ID=”ddl” runat=”server” DataSourceID=”mydatasource”
DataTextField=”text” DataValueField=”id”
SelectedValue=’<%# Bind(“id”) %>’ AppendDataBoundItems=”true” >

et voila, it works! The trick is using Value=”", which is interpreted as a null value during databinding.

Happy coding!

Tags:

Nov 19 2008

.it domains, DNS and LARs

Classified in: Domains, Hosting, site5paomic at 4:12 pm

Did you ever try to register a .it domain? No? Really? But it sounds goot, I mean the pronoun it is a very good extension for creating domains such as got.it, get.it, justdo.it and many others. You also have cheap hosting such as Tophost. I wonder why you never tried to register such a good extension… Well, maybe because you need to send a fax to register a domain! YES! You need a fax! It seems old, anachronistic, odd, unbelievable, and much more, but yes, you need this fax. And guess? If a registered domain expires, the first who sends the fax will get it! Ahahahahah In these days with all these technological communication systems, you still need a fax. And guess again what happens if the fax is not perfectly sent? Your registration gets refused! It’s unbelievable how many fax I had to send for a domain! And another thing: the Italian nic, when you try to change the DNS for an .it domain checks that the domain is present in the name server, so for example by using an hosting service such as Site5, which offers a cool feature such as domain pointers, which checks that you have instructed the domain to use their name servers (dns.site5.com and dns2.site5.com), you cannot add them! Luckily people at Site5 are very friendly and would gladly help you out and solve this problem!

 

Anyway, I suggest you to keep out from .it domain, at least until they switch to a syncronous system, which doesn’t need fax!

Tags: