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

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="TakeSurveyTest.aspx.vb" Inherits="TakeSurveyTest" %>
And the ascx page starts out:

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

The PreRender code on my ascx page is:

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

What is missing?

Thanks,

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

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

Tom

"tshad" <tf*@dslextreme.comwrote in message
news:%2****************@TK2MSFTNGP04.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="TakeSurveyTest.aspx.vb" Inherits="TakeSurveyTest" %>
And the ascx page starts out:

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

The PreRender code on my ascx page is:

Sub Page_PreRender(ByVal Sender As Object, ByVal E As EventArgs)
viewstate("TimeStart") = TimeStart
viewstate("ScreenRight") = ScreenRight
viewstate("ScreenWrong") = ScreenWrong
viewstate("LastTime") = 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**************@TK2MSFTNGP02.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****************@TK2MSFTNGP04.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="TakeSurveyTest.aspx.vb" Inherits="TakeSurveyTest" %>
And the ascx page starts out:

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

The PreRender code on my ascx page is:

Sub Page_PreRender(ByVal Sender As Object, ByVal E As EventArgs)
viewstate("TimeStart") = TimeStart
viewstate("ScreenRight") = ScreenRight
viewstate("ScreenWrong") = ScreenWrong
viewstate("LastTime") = 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
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...
1
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...
1
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...
4
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...
1
by: Marcel Balcarek | last post by:
I create a user control dynamically: Dim newCriteriaControl As CriteriaTextBoxUserControl = CType(Me._page.LoadControl("CriteriaTextBoxUserControl.ascx"), CriteriaTextBoxUserControl) ...
8
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,...
8
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...
1
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...
2
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...
0
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...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.