Wednesday, November 3, 2010

Validate Dropdown in

You can validate default selected index value of the drop down by using require field validator. As the validation process is executed at client side it reduce extra post back of your page. To do this you have to just out the require filed validator on page and set the default values of it such as ErrorMessage, ControlToValidate. To validate the default value of drop down you have to set the "InitialValue" property of validator to default value of it. here is the sample code with MySql

For those of you who don’t know, MySQL is an open-source DataBase server. Being that it’s open-source, it’s also free. That’s about as low-cost as you can get. Of course, you may ask ‘Why use MySQL’? Did you read the previous sentences?? It’s free, as well as being a fairly robust database server!

To be able to use MySQL, there are a couple of downloads that must be done:
MySQL Itself

The Database Server (MySQL), itself can be downloaded here:

The Driver (for Windows) can be downloaded here:

The biggest hurdle in using MySQL, is the setup – much like many other users of MSDE have found out. Without a user interface, it’s quite cumbersome, requiring a command prompt to do all the work. Here’s the best page I’ve found so far to take you, step-by-step through this process:

Now, once this is all set up – guess what – you have no data. If you want, the above installation page will also help you get started creating databases, tables and fields for your sample data. But, if you want a much quicker way to populate your database server, so you can get started, AugustWind Software has user interface for MySQL called Data Management Toolkit. Check it out here

Event Handler Feature

This example simply shows how to handle delete item event of list in share point.

Create the event handler in visual studio

1. Create a new project in Visual Studio by clicking File, pointing to New, and then clicking Project.

2.In the New Project dialog box, select Visual C# in the Project types box, select Class Library in the Templates box, type DeletingEventHandler in the Name box, and then click OK.

3. In Solution Explorer, select DeletingEventHandler, and click Add Reference on the Project menu.

4. In the Add Reference dialog box, select Microsoft.SharePoint on the .NET tab and then click OK.

5. Add the following code within the class to override the ItemDeleting method.

public override void ItemDeleting(SPItemEventProperties properties)
properties.Cancel = true;
properties.ErrorMessage = "You can not delete item from " +

6. In Solution Explorer, right-click the DeletingEventHandler node, and then click Properties.

7. In the Properties dialog box, click the Signing tab, select Sign the asembly, select Choose a strong name key file, and then click .

8. In the Create Strong Name Key dialog box, type DeletingEventHandler.snk in the Key file name box, optionally specify a password for the key, and then click OK.

9. Build the project.

10. Find the \DeletingEventHandler\bin\Debug folder in the Visual Studio Projects folder, and drag the DeletingEventHandler.dll file to Local_Drive:\WINDOWS\assembly to place the
DLL in the global assembly cache.

To Add Event handler as a windows share point services feature

1. Create a folder in Local_Drive:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/FEATURES called DeletingEventHandler.

2. Create a Feature.xml file in this folder like the following that identifies the Feature and its element manifest file and sets the Feature scope to Web site.


3. To replace the GUID placeholder in the previous Id attribute, generate a GUID by running guidgen.exe located in Local_Drive:\Program Files\Microsoft Visual Studio 8.

4. Create an Elements.xml file in the DeletingEventHandler folder that identifies the assembly, class, and method to implement as the event handler. This example applies the event handler to all announcements lists of a site, as specified by the ListTemplateId attribute. For the IDs of other default Windows SharePoint Services list template types, see the Type attribute description of the ListTemplate element.

DeletingEventHandler, Version=, Culture=neutral, PublicKeyToken=a26b5449ac4a4cf3Assembly>

5. To get the Public Key Token of the assembly, in Windows Explorer find the DeletingEventHandler.dll file in the Local_Drive:\WINDOWS\assembly, right-click the file, click Properties, and on the General tab of the Properties dialog box, select and copy the token.

6. At a command prompt, navigate to \Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN on the local drive, and type each of the following commands to install the Feature in the deployment, activate the Feature on a specified subsite, and reset Microsoft Internet Information Services (IIS) so that the changes take effect:

stsadm -o installfeature -filename DeletingEventHandler\Feature.xml

stsadm -o activatefeature -filename DeletingEventHandler\Feature.xml -url http://Server/Site/Subsite


7. Try to delete an item in an announcements list on the specified Web site to see the effects of the event handler Feature

Reference -

Tuesday, November 2, 2010

Sharepoint Feature RegistrationID

RegistrationId List Template Type IDs:
InvalidType = -1
GenericList = 100
DocumentLibrary = 101
Survey = 102
Links = 103
Announcements = 104
Contacts = 105
Events = 106
Tasks = 107
DiscussionBoard = 108
PictureLibrary = 109
DataSources = 110
WebTemplateCatalog = 111
UserInformation = 112
WebPartCatalog = 113
ListTemplateCatalog = 114
XMLForm = 115 (InfoPath Forms Library)
MasterPageCatalog = 116
NoCodeWorkflows = 117
WorkflowProcess = 118
WebPageLibrary = 119
CustomGrid = 120
DataConnectionLibrary = 130
WorkflowHistory = 140
GanttTasks = 150
Meetings = 200
Agenda = 201
MeetingUser = 202
Decision = 204
MeetingObjective = 207
TextBox = 210
ThingsToBring = 211
HomePageLibrary = 212
Posts = 301
Comments = 302
Categories = 303
Pages = 850
(thanks to Anders Jacobsen for this one)IssueTracking = 1100
AdminTasks = 1200
Translation Management Library = 1300
Languages & Translations = 1301