Today I expanded my knowledge of Web Parts, which is my favorite addition to ASP.NET in ASP.NET 2.0. I learned how to create custom properties for my web parts and I added a property to my Newsvine web part so that the user can change the RSS feed. It seems you never learn all there is to know about ASP.NET because I also learned there are two ways to register a user control. I was familiar with the method of supplying the source file path but I was not familiar with using a namespace with the tagprefix.
There are two ways to register user controls:
Register Namespace=”namespace” TagPrefix=”tagprefix” Assembly=”assembly”
Register TagPrefix=”tagprefix” Tagname=”tagname” xsrc=”pathname”
tagprefix – An alias to associate with a namespace.
tagname – An alias to associate with a class.
Namespace – The namespace to associate with tagprefix.
Src – The location (relative or absolute) of the declarative user control file to associate with the tagprefix:tagname pair.
Assembly – The assembly in which the namespace that you are associating with tagprefix resides.
A Web Part verb is a custom action that a user can perform. You can add verbs to the Web Part menu. The example code I studied adds a verb to send an email but it did not implement the actual functionality. My ASP.NET code for sending an email has been deprecated so I had to learn the new way of sending email to actually implement the new Web Part verb functionality.
Web Parts can exchange data through provider and consumer connections. I didn’t create my own version of the example code but I did get screenshots of how the Connections Zone looks in the browser and practiced making connections between web parts and then disconnecting them. I’ll probably expand my notes on Web Part Connections when I try to create my own and encounter technical difficulties.
I bought a book that is specifically on Web Parts, ASP.NET 2.0 Web Parts in Action: Building Dynamic Web Portals (In Action) by Darren Neimke. I am reading this book on my lunch breaks. Unfortunately, there probably won’t be anything else to learn after I’ve finished reading that book. Most of the articles and tutorials on web parts just cover the same basic features. I don’t think I’ll be able to find any advanced techniques or really useful examples because the developer community does not appear to be too excited about web parts.