Link to home
Start Free TrialLog in
Avatar of baxleyb
baxleyb

asked on

C# User control on page load

Hello,

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.

Thanks.
display-user-error.GIF
version1.txt
version2.txt
ASKER CERTIFIED SOLUTION
Avatar of saabir_sopariwala
saabir_sopariwala
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of baxleyb
baxleyb

ASKER

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=1.0.0.0" %>

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=1.0.0.0' 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.