Questions tagged [preinit]

12 questions
10
votes
2 answers

Difference with creating and adding controls in PreInit Init

There's tons of info on the web about the ASP.NET life cycle, but i can't seem to figure out when to dynamically add controls to the page. In general there are two situations; an aspx page with a masterpage, and one without. The book i'm currently…
Peanutbag
  • 277
  • 1
  • 4
  • 11
8
votes
4 answers

How to get control in ASP.NET PreInit event?

How to get control in ASP.NET PreInit event? Pointers are null and FindControl method returns null. I am using master and content pages. Markup of the content page looks like this:
brain_pusher
  • 1,507
  • 3
  • 21
  • 31
8
votes
4 answers

Why master page doesn't have PreInit event in ASP.NET?

The following is the sequence in which events occur when a master page is merged with a content page: Content page PreInit event. Master page controls Init event. Content controls Init event. Master page Init event. Content page Init event. Content…
Aditya Singh
  • 9,512
  • 5
  • 32
  • 55
3
votes
2 answers

asp.net page's preinit event

I am new to asp.net. I have an aspx page and i have to write some code in its PreInit event. From where i find PreInit event on the page. As we double click on button to get button click event(or selecting button and select event from property…
liaqat ali
  • 241
  • 2
  • 3
  • 7
2
votes
4 answers

If I cannot use OnPreInit in Controls, how can I add my controls dynamically on the right time?

I want to have a user control which will add some checkboxes in a asp.NET panel dynamically. Simply I was believing I can do that easily in control's OnPreInit method. But the thing is I have learn that I cannot use and override OnPreInit method on…
pencilCake
  • 51,323
  • 85
  • 226
  • 363
2
votes
1 answer

How to Access ASP.NET Page Controls During PreInit?

Recently I've used a class as explained here to access dynamic controls during PreInit. The post is titled as "Accessing ASP.NET Page Controls During PreInit", and in local it works perfect, but on server I get the following error: Compiler Error…
Kardo
  • 1,658
  • 4
  • 32
  • 52
1
vote
1 answer

How to set master page on page preinit based on custom user control method result

I have a user control that checks if a certain query string and session value are present then returns a boolean based on that, if it's true I want to set the master page. The page is throwing an Object reference exception when it tries to call the…
FarFigNewton
  • 7,108
  • 13
  • 50
  • 77
1
vote
1 answer

javafx show dialog before init

I would like to know the best way to show a dialog(Stage) before the init method of the main application is called. I can't implement it in the init method because it doesn't run on the JavaFX Application Thread and when implementing it in the start…
Scourge
  • 11
  • 4
1
vote
1 answer

PreInit doesn't always seem to apply

Because of the situation, I have a radiobuttonlist control within the page that's populated within the control In preinit, I then check and see the sql enrollment count and if it's above a certain number, disable it. I've been doing this call in…
0
votes
2 answers

MasterPage Load Theme

on asp.net C#, i want to change the theme when page is load, this action requiers PreInit Event, Which Masterpage dont have. what is the solution for that issue? thanks,
Roy Amir
  • 457
  • 1
  • 6
  • 15
0
votes
4 answers

C# / apsx.net - Dynamically created button doesn't work

Here is my problem: I had dynamically created some buttons in my page (in the Page_PreInit method), all linked to the same event handler. But those buttons don't fire the event when I click on them... Can someone help me? Here is some of my…
Alban Becquet
  • 80
  • 1
  • 1
  • 12
0
votes
3 answers

Themes aren't setting

I'm using this code to change the applications theme protected void Page_PreInit(object sender, EventArgs e) { MasterPage m = Master; string theme = Session["theme"].ToString(); Page.Theme = theme; } The…
Nicolas Pierre
  • 1,174
  • 1
  • 21
  • 39