471,321 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

UserControls in ASP.NET 2.0

Hi,

I am new to ASP having previously been doing Java.

I think User Controls are good but I have problem that I cannot solve -
spent a long time searching the

web without so far much success.

The problem:

I am using a UserControl to display a company log on the page with the
thought that if the logo changes I

can change the view on the Web site without having to alter any code.

However our site is to be marketed to different companies who will want to
see their own logo on the

page.

The original UserControl ascx file merely delivers the logo in an img tag.

My goal is to allow the following:

Example: User (a) logs and sees the logo for the company they work for
User (b) logs into the same site but sees a different logo as
they work for
a different company.

I am attempting to do this programmatically but failing at the moment.

Is it possible to alter the ascx file called for each user within the .cs
file Page_Load method?

My master file has:

<%@ Register Src="UserControls/ClientIcon.ascx" TagName="ClientIcon"
TagPrefix="uc1" %>

....
<body>
....
<uc1:ClientIcon ID="ClientIcon1" runat="server" />
....
</body>

Each separate ascx file has:

<%@ Control Language="C#" ClassName="ClientIcon" AutoEventWireup="true"
CodeFile="ClientIcon.ascx.cs"

Inherits="UserControls_ClientIcon" %>
<div>
<img src="images/[name of logo gif file]" width="280" height="91"
alt="Client image" border="0"

class="ClientIcon">
</div>

Hope this is understandable - can anyone help please.

Thanks in advance

Andrew

P.S If this is the wrong way please let me know - thanks

--
Andrew Mercer
-----------------
Feb 13 '06 #1
1 1113
First of all, there is an AdRotator Control in the framework you may find
useful. Secondly, you should be using ASP.NET 2.0 Membership, Roles and
Profiles to manage authentication, what is or is not displayed and to whom.
These two recommendations will enable you to provide an elegant solution.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


"Andrew Mercer" <ak*******@yahoo.co.uk(donotspam)> wrote in message
news:34**********************************@microsof t.com...
Hi,

I am new to ASP having previously been doing Java.

I think User Controls are good but I have problem that I cannot solve -
spent a long time searching the

web without so far much success.

The problem:

I am using a UserControl to display a company log on the page with the
thought that if the logo changes I

can change the view on the Web site without having to alter any code.

However our site is to be marketed to different companies who will want to
see their own logo on the

page.

The original UserControl ascx file merely delivers the logo in an img
tag.

My goal is to allow the following:

Example: User (a) logs and sees the logo for the company they work for
User (b) logs into the same site but sees a different logo as
they work for
a different company.

I am attempting to do this programmatically but failing at the moment.

Is it possible to alter the ascx file called for each user within the .cs
file Page_Load method?

My master file has:

<%@ Register Src="UserControls/ClientIcon.ascx" TagName="ClientIcon"
TagPrefix="uc1" %>

...
<body>
...
<uc1:ClientIcon ID="ClientIcon1" runat="server" />
...
</body>

Each separate ascx file has:

<%@ Control Language="C#" ClassName="ClientIcon" AutoEventWireup="true"
CodeFile="ClientIcon.ascx.cs"

Inherits="UserControls_ClientIcon" %>
<div>
<img src="images/[name of logo gif file]" width="280" height="91"
alt="Client image" border="0"

class="ClientIcon">
</div>

Hope this is understandable - can anyone help please.

Thanks in advance

Andrew

P.S If this is the wrong way please let me know - thanks

--
Andrew Mercer
-----------------

Feb 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Anders K. Jacobsen [DK] | last post: by
3 posts views Thread by YYZ | last post: by
reply views Thread by seigo | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
4 posts views Thread by Nathan Sokalski | last post: by
7 posts views Thread by Nathan Sokalski | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.