ValidationGroup in ASP.NET 2.0

by Peter Tyrrell Thursday, January 18, 2007 12:12 PM

It seems like I just can't find enough gotchas this week. My latest is the use of the ValidationGroup attribute when validating user input in ASP.NET 2.0.

If you use ValidationGroup="Foo" on a validation control, then the postback control (a Submit button, perhaps) must also reference that validation group, or no validation occurs. In hindsight, this is logical and even obvious. Hindsight is always annoyingly obvious. Meanwhilesight, however, had me crossing my eyes in vexation because I couldn't understand why the validation controls simply weren't firing (client-side or server-side).

I had used ValidationGroup on all my validation controls, but had forgotten to reference the group name when I added a button the next day. The .NET can be a harsh mistress.


BookWhere, MARC Records and Inmagic Genie

by Administrator Wednesday, January 17, 2007 10:32 PM

A client of ours recently started using the new BookWhere XML MARC record import feature of Inmagic Genie. They noticed that although the new feature allowed them to import MARC records nicely into Genie, it did not import a call number from any of the records. There are several MARC call numbers that could be used, depending on the classification system used by the Genie user. See for specifics on which MARC field you should use. We have used MARC field 050 - Library of Congress Call Number - in this example (leave out leading zero).

Yes, we have no bananas

by Peter Tyrrell Wednesday, January 17, 2007 3:31 PM

I *am* calling it during Render, you paraphylectic polygon. That's the whole point.


"Interesting" WAP quirk #87

by Ted Jardine Monday, January 15, 2007 1:26 PM

Anyone using WAP (Web Application Projects) for ASP.NET 2.0 development will know what I'm talking about here: you love it for some things (otherwise, why would you bother using it?), and will just shake your head at the time wasted trying to figure out its various little quirks. Peter (as usual) had an eloquent/insightful/as-usual-make-me-roll-on-the-ground-laughing way to describe WAP implementation the other day, but I can't remember it (perhaps he'll come up with one in the comments?). But here is quirk #87 (or whatever quirk we're up to now): I am attempting to change a Profile property in a WAP project following successful login. This works no problem in a typical Website Project, but in a WAP I get this: "This property cannot be set for anonymous users". Ummm, nooooo...the user is not anonymous as the only way to get here is if the user has successfully logged in. Googling brought up others with the problem, but no solution. So here I am to save your day (or at least brighten it up a little bit): private WebProfile profile; private WebProfile Profile { get { if (profile == null) profile = new WebProfile(Context.Profile); return profile; } } protected void LoginControl_LoggedIn(object sender, EventArgs e) { Profile.Initialize(LoginControl.UserName, true); Profile.PropertyYouWantToChange = "New Value"; Profile.Save(); // Note that you've got to save here if you turn Profile AutoSave off in the Web.config (recommended) } In retrospect, you can figure out why this rigamole is required (well, maybe), but it still shouldn't be that way. Oh well...I await some Tyrrellian Quote that will help us deal with the emotional pain.


Hanselminutes Podcast

by Peter Tyrrell Monday, January 15, 2007 11:04 AM

Every Saturday morning I clean the house and listen to podcasts on my iPod. My favourite is Hanselminutes. My second favourite is The Word Nerds, which doesn't help me grow as a developer like Hanselminutes, though it does help grow my already keen sense of grammatical fascism. Hanselminutes is hosted by Carl Franklin and Scott Hanselman, an unflappable web developer and technologist* who blogs and speaks frequently about utilities and tools and ASP.NET and Windows, with much practical advice. I learn a lot about new technologies from his weekly show, without having to read dull dull whitepapers. Scott likes his podcast tag line to be "the show that doesn't waste your time" and to date, it never has. * I don't know what a technologist is either, but it sounds cool.


Month List