views:

49

answers:

3

i am trying to set up a wrapper for a user control to be used in Moss 2007 but there is a problem that I can see my user control hosted in the web part but the cs file is not being executed so all the functions and activities in the page_load and other functions is being ignored. I have followed this article.

http://www.c-sharpcorner.com/UploadFile/nipuntomar/1126/

Can someone please suggest what should be done as it is such a simple task and it has wasted a lot of time on my end.

A: 

Is there a specific reason why you are creating the wrapper yourself ? I'm asking this because there already is a great solution for this: the SmartPart by Jan Tielens.

http://smartpart.codeplex.com/

Tom Vervoort
ya i know that. in fact i used the smartpart earlier but for some reason the client wants me not to use the smart part :(
ria
last time i looked at smartpart it wasn't the safest of ways to implement functionality: requires too many permissions
ArjanP
A: 

Did you set AutoEventWireup="true" in the ASCX file? If yes try to move your code CreateChildControls or Render to see whether your code is executed at all...

Bernd
A: 

I get this sometimes when I forget to adequately put the right namespaces in place. Your project needs to be signed and all ASCX files need to have the full namespace reference in:

<%@ Control Language="C#" AutoEventWireup="true" Inherits="SampleWebPart.SampleWebUserControl, SampleWebPart,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" %>

Note the publickeytoken, you need your own value in there.

ArjanP