473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 1182
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kate | last post by:
Hi: I have a picturebox control, and at runtime various usercontrols are added to it to make a diagram. As dynamically added usercontrols, they are of type VBExtender. Is there a way to save...
2
by: Emma | last post by:
Hi, I'm developing a GUI with almost all Usercontrols. It's been working wonderfull up till a few weeks ago, and really crashed yesterday. Suddenly I can no longer add some of my usercontrols...
4
by: Anders K. Jacobsen [DK] | last post by:
Hi I have some common UserControls i want to share between to sites (on the same mashine but on diffrent virtual paths). right now i have on solution file with aprox 10 projects. 2 of these is...
2
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page...
3
by: YYZ | last post by:
I swear I've done my research, and now I was just hoping someone could explain this to me. I've got a base class (usercontrol) that I am using just as an interface. Meaning, I've defined...
3
by: b747_440 | last post by:
Dear Newsgroup, I'm an old VB6.0 developper who switched some time ago to VB.NET 2005. I really like that new Visual Studio. However, something is going wrong now and I can't figure out, what it...
0
by: seigo | last post by:
Hello, I faced with the following problem. I have a PlaceHolder on a page and a few UserControls which have custom events, for instance: public delegate void SelectHandler(object sender,...
3
by: Nathan Sokalski | last post by:
I have my UserControls in a subdirectory called usercontrols. In the code for one of my UserControls I have the following: Public Property adimage() As String Get Return...
4
by: Nathan Sokalski | last post by:
In several of my UserControls I add properties. If I access these properties in the CodeBehind of the pages that use the controls, I recieve an error when compiling. The reason for this is because...
7
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.