473,323 Members | 1,547 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,323 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 1052

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...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.