473,411 Members | 1,949 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,411 software developers and data experts.

Help with ASCX Issue!

I have a web project that currently has a standard header, footer, and
menu ascx files. I am now suppose to change the project to allow a
user to choose from 3 different views, ie 3 different groups of those
.ascx files. Does anyone have some sample code on how to do this?
This needs to check once a user has signed in on which version to
display.

Thanks,
Wade

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
2 1284
> I have a web project that currently has a standard header, footer, and
menu ascx files. I am now suppose to change the project to allow a
user to choose from 3 different views, ie 3 different groups of those
ascx files. Does anyone have some sample code on how to do this?
This needs to check once a user has signed in on which version to
display.


I'm no expert, but I did something similiar for a screen version vs. a
'print friendly' version.

What I did is put the options inside the individual controls. ie, the page
links to the same header and footer, but depending on a querystring, these
two ASCX files return different HTML.

With judicious use of CSS (taking a lot of the styling out of the app) this
might be a solution for you.

-Darrel
Nov 18 '05 #2
"Wade Beasley" <wa**********@insightbb.com> wrote in message
news:eL****************@TK2MSFTNGP09.phx.gbl...
I have a web project that currently has a standard header, footer, and
menu ascx files. I am now suppose to change the project to allow a
user to choose from 3 different views, ie 3 different groups of those
ascx files. Does anyone have some sample code on how to do this?
This needs to check once a user has signed in on which version to
display.


You can use LoadControl to load the proper version of the .ascx file. The
following example is ripped off from Microsoft, then modified a bit:

private string whichView;

// When this page is loaded, it uses the TemplateControl.LoadControl
// method to programmatically create a user control. The user control
// is contained in the .ascx file that is passed as a parameter
// in the LoadControl call. The page then adds the control to its
// ControlCollection.
void Page_Load(object sender, System.EventArgs e)
{
// Obtain the UserControl object MyHeader from the
// user control file MyHeader_*.ascx.
if (!User.IsAuthenticated)
whichView = "default";

Control myHeader= LoadControl(whichView + "_MyHeader.ascx");
Controls.Add(myHeader);
}

You might then have default_MyHeader.ascx, wide_MyHeader.ascx, and
green_MyHeader.ascx, depending on the value of whichView. You could do the
same with your footer and menu files.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dan Nigro | last post by:
I am trying not to use frames in asp.net but this is my problem. I have an image viewer I am trying to developed. The top portion is the (next, previous page, zoom etc). The left side is and...
1
by: Andrew Parsons | last post by:
Hi all, I had a weird issue with trying to use a cookie in a ASCX housed on my web forms and I was wondering if I am missing something. I wanted to use the authenticated cookie for the user...
2
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
1
by: Jouni Heikniemi | last post by:
Hi, This has been asked before, in <http://groups.google.fi/groups? selm=ureiu7b04kv839%40corp.supernews.com> for example; however, I haven't found any real answers, so I'll post this with some...
10
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I...
5
by: Marc Violette | last post by:
<Reply-To: veejunk@sympatico.ca> Hello, I'm hoping someone can help me out here... I'm a beginner ASP.NET developper, and am trying to follow a series of exercises in the book entitled...
0
by: Tonix | last post by:
This problem was originated by Thanh Nguyen. Your help is appreciated. Thanks. The original text is: Hi everyone, I'm encountering a very weird problem, I have spent the last 3 days trying to...
3
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
11
by: Brad Baker | last post by:
I'm building a small web application - I started out placing all my code in one file (config.aspx). As I continue to add code though it was becoming very unwieldy. After doing some searching...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.