Thursday, November 16, 2006

Happens every time - adding a web part class to a project

I hate it when I dont learn from my bad experience...

When I have a solution with a web part and I want to add another web part to the same project I just right click the project, select "Add" and choose "Class". Then I tell the class to inherit from "WebPart" and proceed to program my code.

And when I get to deploying it - the new class isnt shown in the new webparts gallery!

why?

because I forget every time to mark the class as "public" - when Visual Studio creates a new class in a project, the default is just "class newwebpart".

So the lesson for today - dont beat yourself going over the web.config file - just make sure the class is marked public.

No comments: