Hi,
the subject says it all. Since visible=false controls will still run
though Page_Load, I was hoping that the MultiView would somehow manage
to avoid a Page_Load of controls in its inactive Views. But of course
it does not.
I guess a safe way to avoid Page_Load is to only add the controls at
runtime into the activated view. Which of course neglects the beauty
of editing the layout if several views in one ascx.
Is there a more elegant way or at least a way to safely jump out of
Page_Load of the control (without checking the state of the parents,
please - since the control is not supposed to work in a View only).
TIA for any hint,
Regards
DC 4 2116
I suppose you could put them in an ascx file and dynamically load them
using LoadControl() but, the only way this will work is if you never
switch views as part of a post back OR you don't use viewstate.
The reason it loads all of the controls is so that it can re-establish
the state of the objects.
-----Original Message-----
From: DC [mailto:dc@upsiz e.de]
Posted At: Wednesday, November 28, 2007 10:47 AM
Posted To: microsoft.publi c.dotnet.framew ork.aspnet
Conversation: Avoid execution of "Page_Load" of controls contained in
MultiView Views
Subject: Avoid execution of "Page_Load" of controls contained in
MultiView Views
Hi,
the subject says it all. Since visible=false controls will still run
though Page_Load, I was hoping that the MultiView would somehow manage
to avoid a Page_Load of controls in its inactive Views. But of course
it does not.
I guess a safe way to avoid Page_Load is to only add the controls at
runtime into the activated view. Which of course neglects the beauty
of editing the layout if several views in one ascx.
Is there a more elegant way or at least a way to safely jump out of
Page_Load of the control (without checking the state of the parents,
please - since the control is not supposed to work in a View only).
TIA for any hint,
Regards
DC
Is there a more elegant way or at least a way to safely jump out of
Page_Load of the control (without checking the state of the parents,
please - since the control is not supposed to work in a View only).
I believe that the "Visible" property automatically checks the visibility of
parent/container controls. So you could try:
public void Page_Load(blah, blah,blah)
{
if (this.Visible)
{
DoYourWork();
}
}
On 28 Nov., 21:10, "Scott Roberts" <srobe...@no.sp am.here-webworks-
software.comwro te:
Is there a more elegant way or at least a way to safely jump out of
Page_Load of the control (without checking the state of the parents,
please - since the control is not supposed to work in a View only).
I believe that the "Visible" property automatically checks the visibility of
parent/container controls. So you could try:
public void Page_Load(blah, blah,blah)
{
if (this.Visible)
{
DoYourWork();
}
}- Zitierten Text ausblenden -
- Zitierten Text anzeigen -
Thank you, Scott. This works in most situations. It is however
unreliable, because visibility of the control may be changed after the
Page_Load (but before Render).
On 28 Nov., 17:06, "Dave Bush" <davemb...@dmbc llc.comwrote:
I suppose you could put them in an ascx file and dynamically load them
using LoadControl() but, the only way this will work is if you never
switch views as part of a post back OR you don't use viewstate.
The reason it loads all of the controls is so that it can re-establish
the state of the objects.
-----Original Message-----
From: DC [mailto:d...@ups ize.de]
Posted At: Wednesday, November 28, 2007 10:47 AM
Posted To: microsoft.publi c.dotnet.framew ork.aspnet
Conversation: Avoid execution of "Page_Load" of controls contained in
MultiView Views
Subject: Avoid execution of "Page_Load" of controls contained in
MultiView Views
Hi,
the subject says it all. Since visible=false controls will still run
though Page_Load, I was hoping that the MultiView would somehow manage
to avoid a Page_Load of controls in its inactive Views. But of course
it does not.
I guess a safe way to avoid Page_Load is to only add the controls at
runtime into the activated view. Which of course neglects the beauty
of editing the layout if several views in one ascx.
Is there a more elegant way or at least a way to safely jump out of
Page_Load of the control (without checking the state of the parents,
please - since the control is not supposed to work in a View only).
TIA for any hint,
Regards
DC- Zitierten Text ausblenden -
- Zitierten Text anzeigen -
Thanks, Dave. I was hoping that I only have to make sure that the
controls which are actually postback targets exist. I am unsure about
how "complete" the control tree must be for postbacks/viewstate to
work. I will try out.
Regards
DC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Patrick Marti |
last post by:
I wish to create some LinkButtons in DotNet. Because I will do it in
dependence of the entries in a database, I can not add them with the mouse
to the form as usually.
I can create them in the Page_Load event but then I can not see them.
I do not know the reason or how to do it correctly.
Do anywhere know something about?
For any help, I thanks a lot
Greetings Patrick Marti
|
by: Leo J. Hart IV |
last post by:
OK, here's another question for the experts:
I am building a multi-step (3 steps actually) form using a panel for
each step and hiding/displaying the appropriate panel/panels depending
on which step you're on. This all works fine, but I ran into some
trouble when I started creating controls dynamically in my code-behind
file.
Each panel contains a table which is filled with various radio buttons,
text fields and the such which are...
|
by: Jon Hyland |
last post by:
This might be a dumb question, but what is the best way for one
instance of a user control to access properties of an instance of
another user control?
For example, let's say I have an instance of UserControlA (ucA1) and
an instance of UserControlB (ucB1) on a particular ASP.NET page.
UserControlA has a string property called StringA that gets generated
from a DB call in it's Page_Load event. I want UserControlB to be
able to access...
|
by: Ranginald |
last post by:
Hi,
I have two pages.
Default.aspx
....Codefile="default.aspx.cs" Inherits="Web" %>
and
Sculpture.aspx
|
by: tshad |
last post by:
I have a PageInit.ascx that I want to put in all my pages and have it
execute only once during the "not IsPostback" section. I also need it to
execute first before anything else.
I have it set as:
<%@ Register TagPrefix="fts" TagName="pageInit"
Src="/controls/pageInit.ascx" %>
....
<body>
| |
by: DC |
last post by:
The Code
<%@ import namespace="System" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.UI" %>
<%@ import namespace="System.Web.UI.HtmlControls" %>
<%@ import namespace="System.Web.UI.WebControls" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
|
by: DC |
last post by:
The problem
I'm using the .NET GridView and FormView objects for the first time and
im getting the error "An OleDbParameter with ParameterName '@ID' is not
contained by this OleDbParameterCollection" whenI try to write a new record.
Delete and Modify work fine its just the add record function causes the
error.
|
by: Spectre1337 |
last post by:
Hello,
to my understanding the ASP.NET process works as follows:
1) Page_Init(): At this moment the user should allocate his controls, set their IDs and connect them to the page (Controls.Add()).
2) ASP.NET is parsing the ViewState and the rest of the HTTP Request. It now synchronizes the controls that the user has allocated in Page_Init() according to their ID.
3) Page_Load(): At this point the user controls should be initialized...
|
by: mj.redfox.mj |
last post by:
Can anyone help? I have a textbox which I'm programatically adding by
using the following code:
txtTest = New TextBox
txtTest.ID = "txtLeft" + cntCount.ToString
Page.FindControl("tdInput").Controls.Add(txtTest)
This successfully creates a textbox called "txtLeft1" in the table
|
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,...
|
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...
| |
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...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |