473,767 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PreRender on my User control not firing

In VS 2008, I have 2 pages, one aspx page and one ascx page.

The PreRender event is not firing on the Contol page.

The aspx page starts out:

<%@ Page Language="VB" AutoEventWireup ="true" Trace="true"
CodeFile="TakeS urveyTest.aspx. vb" Inherits="TakeS urveyTest" %>
And the ascx page starts out:

<%@ Control Language="VB" AutoEventWireup ="true"
CodeFile="TakeS urveyTest.ascx. vb" Inherits="TakeS urveyTest" %>

The PreRender code on my ascx page is:

Sub Page_PreRender( ByVal Sender As Object, ByVal E As EventArgs)
viewstate("Time Start") = TimeStart
viewstate("Scre enRight") = ScreenRight
viewstate("Scre enWrong") = ScreenWrong
viewstate("Last Time") = LastTime
End Sub
The control works fine other than that.

What is missing?

Thanks,

Tom
Oct 2 '08 #1
2 6365
I figured it out.

The control wasn't visible - so it didn't fire.

Tom

"tshad" <tf*@dslextreme .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
In VS 2008, I have 2 pages, one aspx page and one ascx page.

The PreRender event is not firing on the Contol page.

The aspx page starts out:

<%@ Page Language="VB" AutoEventWireup ="true" Trace="true"
CodeFile="TakeS urveyTest.aspx. vb" Inherits="TakeS urveyTest" %>
And the ascx page starts out:

<%@ Control Language="VB" AutoEventWireup ="true"
CodeFile="TakeS urveyTest.ascx. vb" Inherits="TakeS urveyTest" %>

The PreRender code on my ascx page is:

Sub Page_PreRender( ByVal Sender As Object, ByVal E As EventArgs)
viewstate("Time Start") = TimeStart
viewstate("Scre enRight") = ScreenRight
viewstate("Scre enWrong") = ScreenWrong
viewstate("Last Time") = LastTime
End Sub
The control works fine other than that.

What is missing?

Thanks,

Tom


Oct 2 '08 #2
But there lies the question.

If you set the control as visible=false and the PreRender event doesn't
fire - does the PageLoad event fire?

Also, I assume the IsPostBase is based on the page and not the control. But
if that is the case, how do you initialize the control.

I would normally do that in the "if not IsPostBack" code of my PageLoad
event. But will that happen when the control is not visible?

Thanks,

Tom

"tshad" <tf*@dslextreme .comwrote in message
news:ew******** ******@TK2MSFTN GP02.phx.gbl...
>I figured it out.

The control wasn't visible - so it didn't fire.

Tom

"tshad" <tf*@dslextreme .comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>In VS 2008, I have 2 pages, one aspx page and one ascx page.

The PreRender event is not firing on the Contol page.

The aspx page starts out:

<%@ Page Language="VB" AutoEventWireup ="true" Trace="true"
CodeFile="Take SurveyTest.aspx .vb" Inherits="TakeS urveyTest" %>
And the ascx page starts out:

<%@ Control Language="VB" AutoEventWireup ="true"
CodeFile="Take SurveyTest.ascx .vb" Inherits="TakeS urveyTest" %>

The PreRender code on my ascx page is:

Sub Page_PreRender( ByVal Sender As Object, ByVal E As EventArgs)
viewstate("Time Start") = TimeStart
viewstate("Scre enRight") = ScreenRight
viewstate("Scre enWrong") = ScreenWrong
viewstate("Last Time") = LastTime
End Sub
The control works fine other than that.

What is missing?

Thanks,

Tom



Oct 2 '08 #3

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

Similar topics

0
1066
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 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...
1
7587
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
1
1187
by: Troy | last post by:
I have a usercontrol placed inside a container control on the main form. The user control has an image button plus several text boxes. When I click the button, some sort of activity occurs but the click event in the code behind is never touched. Incidently, the PreRender event with the user control successfully loads dynamic data from a SQL server. I can't explain why this occurrs. Any help is greatly appreciated. Thanks.
4
2446
by: Josh Harris | last post by:
Here is my question: It is common to have many pieces of business logic encapsulated within asp.net user controls. This can be found in high visibility projects such as the iBuySpy portal from MS. Virtually every bit of the site is encapsulated within user controls. The problem begins when you try to have user controls pass information to one another as well as to their parent form. This can be accomplished by creating public...
1
2803
by: Marcel Balcarek | last post by:
I create a user control dynamically: Dim newCriteriaControl As CriteriaTextBoxUserControl = CType(Me._page.LoadControl("CriteriaTextBoxUserControl.ascx"), CriteriaTextBoxUserControl) myContainer.Add(newCriteriaControl) and the user control's load event executes on initial executon of the page. On a POST of the same page, the control is added as above, but the load event is not firing, nor is prerender.
8
1295
by: Alan Silver | last post by:
Hello, I'm trying to write a simple user control as an exercise (and 'cos it might be useful). I am trying to do a simple date picker, which consists of three drop down lists, one for the day, one for the month and one for the year. I know this isn't earth-shattering stuff, but I'm still learning, so please be patient!! I'm having trouble with the properties of the control. I have created the control OK and it displays fine. I added a...
8
2266
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing happens. dim filt as string ... build filter string... UserControl.ReportFilter = filt
1
2096
by: jeanluc.praz | last post by:
I created a user control containing containing a few hyperlinks. How can I change the NavigateUrl inside the user control ? So far I did the following: 1) In the custom control Public Property SetURL() Get
2
1229
by: David Hearn | last post by:
I have a user control that I have built (asp.net 1.1) which has some functions in it to set the text of a label and some proerties of a few other controls. My problem is that I call these functions from the page load event of it's parent form and when I do, I get the famous "Object reference not set to an instance of an object" error. It's almost as if everything is working too fast. It's trying to set proprties for controls that don't...
0
1464
by: yohaas | last post by:
I am dynamically adding user control to a page using Controls.Add(control). It seems that the Page_Load as well as the other page rendering events (Init, PreRender etc...) get fired twice. I assume that they are firing once by the Control.Add and once by the actual rendering of the page. The interesitng thing is that when it is a postback, the first time it fires IsPostBack is true but the second time, it's false. Any ideas what I can...
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10009
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8835
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.