473,396 Members | 1,961 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.

user control declarations ignored

Hi
I have an odd problem with a user control.

- I have an asp page which holds a single usercontrol.
- On that user control I have a button and placeholder. When the button is
pressed I want a user control to loaded into the placeholder.
- I do this by having a flag which is set by the button logic. If in the
PreRender call the flag is set then the control is loaded. I do this in
the PreRender stage because I want to make sure the button postback
has occured (it has, checked in debugger)
- If I do this by explicitly constructing the user control, it doesn't
work (see below for details). If I do this using LoadControl it does.

The manner in which it doesn't work is odd. Basically it doesn't set
the declarations in the ascx file. I have traced through with a watch on the
'this' value. In the OnInit call I can see that the values haven't been set,
using LoadControl I can see they have been set.

- To be exact by declarations I mean statements like this in the ascx file

<asp:Calendar id="calendar" runat="server" Width="250px"></asp:Calendar>
A second complication is that for debugging I included this:

protected override void FrameworkInitialize()
{
base.FrameworkInitialize();
}

I did this so I could see it was being called, also because after the first
line I would have expected the declarations to be setup. It only gets called
using the explicit construction method, not via LoadControl? I would have
expected it to be called for both. It is definately protected for both in the
Temporary ASP.Net file.

Any ideas?
Plus here are some observations with User Controls:
- Page_Load can be called more than once, the way around this seems to be
to use a method name other than Page_Load. I guess the framework includes
calls to this further in.
- using <!-- --> won't comment out code in an ascx page, <%-- --%> will

Thanks
F
Nov 17 '05 #1
0 809

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

Similar topics

0
by: foldface | last post by:
Hi I have an odd problem with a user control. - I have an asp page which holds a single usercontrol. - On that user control I have a button and placeholder. When the button is pressed I want a...
2
by: Steph | last post by:
Hello, I have an user control with any public propertys. I wand set up propertys directlly in a code behind of a page where he will be put in, and not directly in the aspx page. How can I...
10
by: George G. | last post by:
Hi there, I am busy writing a new asp.net application and I am reusing some of my existing asp functions and methods in a user control. I need access to session, request and response in some of...
5
by: Dan Nash | last post by:
Hi all, I've got a page with a user control on, added via VS. I'm trying to get to a property of the user control (or more precisely, a public var). Here's the code at the top of my aspx...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
3
by: vitgi | last post by:
Hi, I created a base user control and then I crated others user controls inheretited from the base one. Any times I modifying my base user control (it's enough add a variable!) I have same errors...
0
by: mschep | last post by:
Hi, I built an assembly with a set of user controls. This can be done with the Visual Studio 2005 Deployment Project: building and merging for example all your aspx and ascx in one dll (lets...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
0
by: Ben Crinion | last post by:
Hi Im having a bit of a problem with an exception that doesnt seem to be bubbling up from a user control to its containing user control. The exception can occur on an event fired by a user...
1
by: tshad | last post by:
External and Internal CSS Style sheets are supposed to only be in the Head section of a page. What about User Controls where there is no head section but you want to be able to load a special...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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,...

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.