Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

issue in custom delegate control

$
0
0

hi 

 am  creating a custom delegate control with controlid ="AdditionalPageHead" . i deployed and activated as a  site collection feature.

but i am not sure how to see the activated control/  how to see this control in action.

below is my code:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Diagnostics;

namespace OPUserDispName
{
  public  class EcmaScriptDelegateControl :WebControl
    {

      protected override void OnLoad(EventArgs e)
      {
          base.OnLoad(e);
          string helloAlert = "alert('Hello, world!');";
          this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "popup", helloAlert, true);

//          if(!HttpContext.Current.User.Identity.IsAuthenticated)
   //              return;
      //       SPUser user = //SPContext.Current.Web.EnsureUser("i:0#.f|OPMembership|OPAdmin");
   //          user.Name = "OPAdmin";
      //       user.Update();
      }
    }
}

in my  elements.xml file  of my module :

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

    <Control Id="AdditionalPageHead" ControlAssembly="OPUserDispName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=467af93481413beb" ControlClass="OPUserDispName.EcmaScriptDelegateControl"></Control>
    
</Elements>


here i wanna see alert when the activated/or page load happened.

may i know, how to see this, in working. as per the current scenario, am unable to see any output even after feature activation. 

do i need to do any settings in master page? do i need to perform any changes in web.config.

help is appreciated!





Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>