1 is easy
right click website or project, 'Add New Item'
Add a class file
add a public static method eg;
myGlobalClass.cs
public class myGlobalClass
{
public static void myGlobalFunction()
{
//function logic ...
}
}
Call it in your code:
myGlobalClass.myGlobalFunction();
2. Derived DataGrid
Create a separate class library project, add a class file myDataGrid.cs
public class myDataGrid : DataGrid
{
//add your override members and methods here
}
Look up ToolboxBitMap, ToolboxData and Designer attributes to customise the icon for the toolbox, what is written to the aspx page when you drag your control into the designer and how it looks in the designer.
Build your class library, In your toolbox right click and choose items and browse to the dll you just built, select the control from the list.
3. I don't really understand what you mean with this one sorry.
What you're asking for is too much to explain properly in a single post in a forum, you need to get yourself a good book on the subject, there are hundreds. These forums are really for when you already have made your derived class, function or whatever and you need help tweaking it or getting it to work.