I created a simple project to Customize a Delegate Control in SharePoint 2010 such as in msdn article (http://msdn.microsoft.com/en-us/library/ms470880.aspx).
Source code: Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
namespace ShowRibbon
{
class ShowRibbonControl : WebControl
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
string helloAlert = "alert('Hello, world!');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "popup", helloAlert, true);
}
}
}
Elements.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control Id="AdditionalPageHead"
Sequence="99"
ControlAssembly="$SharePoint.Project.AssemblyFullName$"
ControlClass="ShowRibbon.ShowRibbonControl"/>
</Elements>
I add SafeControl to Empty Element with Elements.xml, but when I run my solution and set breakpoint in OnLoad method, it is not reached. What may be the reason?