473,670 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

viewstate and postback problem (If there is no property, no controls)

1 New Member
Ok, first of all, forgiveness for my English.

I understand the sequence of events within a control. However, I have a problem when dynamically generates controles.

The Control, loads a collection of items. For each item, there will be a control child. The collection within reside in a property. But what happens if the event "createchildcon trols" happening before my property can be loaded into the viewstate. "If there is no property, no controls"!

The quick solution I found was to re-call the method "createchildcon trols" in the render method. Before rendering, earned my controls have been created. Therefore, the event happens twice.

Another problem is when storing values directly into the viewstate. I don't understand why loading the viewstate after the second postback. Ie, the first postback can not access (from any method) the stored value. However, if at this time I try to store in viewstate, from the second time in the future, I can access this value.

I hope that you have not confused ... I hope someone will help me, I spent weeks trying to fix it
Nov 27 '07 #1
0 940

Sign in to post your reply or Sign up for a free account.

Similar topics

5
11561
by: Yifan | last post by:
Hi Could any one tell me what project property controls the setting of '/RTC1' option? Now I have a project which has this build error "Command line error D2016 : '/RTC1' and '/clr' command-line options are incompatible". But when I view the .vcproj file, I cannot find the '/RTC1' option Thanks Yifan
3
2639
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event and this causes control B to be created, when this is done the VIEWSTATE is lost for CONTROL B. In the EVENT that causes CONTROL B to be created I have to set
1
5373
by: Angel | last post by:
I have added controls to the placeholder control. All the controls that were added have EnableViewState = true including the placeholder. One of the controls has a button that performs a postback. My question is when the button is clicked and a postback is performed, the controls that were in the placeholder no longer appears on the screen! Am I doing something wrong here? Why are the controls back on the screen eventhough they have enable view...
1
1206
by: Jerry Spencer | last post by:
I have a form with two dynamically created controls. One control is a list box, the other is a text box. I would like to set the value of the text box based on the selection of the list box. I have set AutoPostBack for the list box to true so that I get a post on selection change. Even though I recreate the textbox on each postback, I cannot affect the value to the text box. This is the code: private void Page_Load(object sender,...
7
1933
by: John | last post by:
Hi all, I need finality on this once and for all please. I have a main page which contains a couple of placeholders and within these placeholders, depending on what the user presses, I load different user controls. This loading of user controls is done within the code-behind of the main page. The problem is that before loading a user control in place of another, I need to do a Controls.Add then a Controls.Remove so the viewstate is...
0
1763
by: spacehopper_man | last post by:
hi - I am writing a "tab" control. - but it's losing the viewstate of the content pane when I switch between tabs. can anyone shed any light on why I'm losing ViewState based on my simple example below? - if I put the tabs at the top of the screen viewstate is lost -
2
1640
by: mivhaelveloz | last post by:
I thought I had a good grip on viewstate handling, but am suprised by a small test: In my aspx file I have a PlaceHolder control and a button for posting back. Dynamically in Page_Load I create a TextBox, and add it as a control of PlaceHolder. I do this regardless of whether IsPostBack is true or not, to insure
15
3615
by: mc | last post by:
I'm writing an app for managing Task Lists, I'm trying to add some controls to a form that I can use to link tasks, my original intention was to: - Add two list boxes, one listing "all Tasks" and the other listing "Linked Tasks", I have two buttons which in javascript move items from the first list into the second. Then when a user clicks a thrid button I would like to save this data.
1
8361
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an instance of an object.'" I've traced the problem to a custom control I created that inherits from Inherits System.Windows.Forms.TextBox. In this custom control, I have two constructors. I'm not sure why I created the second constructor -- it was so...
1
1936
by: =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?= | last post by:
Hi I have been banging my head for a few days now with this issue. I have a page that has several update panels everything is working fine except for 1 thing. I am creating a sort of wizard that will build a form that I plan to save to a database On stage 2 I load a usercontrol an unspecified number of times depending on
0
8468
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
8386
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
8814
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
8591
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
8660
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
7415
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...
0
4390
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
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
2
1792
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.