Avatar of baxleyb
 asked on

C# User control on page load


I am trying to create a control that I can add to a SharePoint 2007 masterpage.

The code I have works in VB.Net (version 1.txt) and the code I want use is in C# (version2.txt).

I would like the C# code to run on page load and not as a button.

I am getting three errors (display-user-error.GIF).

Any advice or assistance would be appreciated.

Microsoft SharePointMicrosoft Development.NET Programming

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thanks, this appears to work but I have a different question. I am compiling the above code into a dll and then adding it to the masterpage like so:

Top of page:
<%@ Register Tagprefix="DisplayUser" Namespace="Microsoft.SharePoint.Portal.Server" Assembly="DisplayUser, Version=" %>

Bottom of page (display the user account in a comment)
<!-- <DisplayUser:DisplayUser runat="server"/> -->

I get this error:
An error occurred during the processing of . Could not load file or assembly 'DisplayUser, Version=' or one of its dependencies. The system cannot find the file specified.

I don't know if part of the problem is that this code should actually be a user control (.ascx)
 or if it should be a dll.

Thanks for any assitance.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck