Server Controls - avoiding cc*:somecontrol

I have noticed a number of server controls people have put together lately, some commercial but most free on places like Code Project that always render out with the generic tag prefix. It occured to me that the control of this is not readily obvious so maybe I should be kind and point out that you can change this. Lets suppose I was a commercial control vendor named 'Some Company' and wanted to have the prefix 'soc' for my server controls. I would use something called the TagPrefixAttribute to force this behavior. By placing this code in my AssemblyInfo.cs file I get the desired affect.

[assembly:System.Web.UI.TagPrefix("SomeCompany.ServerControl", "soc")]

OK, not earth shattering but it is the little things that can help distinguish a good control from a great one.

2 Comments

  • The only problem with this though, is that you can't have the same prefix for every control you create, if they are in different assemblies. They all have to reside in the same assmebly, because the TagPrefix is a pointer to the assembly file. It sucks and I hope it gets fixed in Whidbey.

  • I like the tag prefix a lot, I have logically similar controls grouped in assemblies.



    It makes it so nice, I see SharedResource:ControlType or MultipleResource:ControlType





Comments have been disabled for this content.