473,785 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I maintain list of controls across posts for a WebControl?

I have created a custom control that derives from WebControl. The custom
control assigns other controls dynamically to the Controls collection. Is
there anyway that I can recall the lost of controls that I assigned to my
custom control when I receive postback?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
Nov 18 '05 #1
5 1598
Keep track of what Controls are being added, and persist that data somewhere
(such as ViewState). Then, on PostBack, read from your "list" and re-add the
appropriate Controls.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ken Varn" <nospam> wrote in message
news:Oa******** ******@tk2msftn gp13.phx.gbl...
I have created a custom control that derives from WebControl. The custom
control assigns other controls dynamically to the Controls collection. Is
there anyway that I can recall the lost of controls that I assigned to my
custom control when I receive postback?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Nov 18 '05 #2
Keep track of what Controls are being added, and persist that data somewhere
(such as ViewState). Then, on PostBack, read from your "list" and re-add the
appropriate Controls.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ken Varn" <nospam> wrote in message
news:Oa******** ******@tk2msftn gp13.phx.gbl...
I have created a custom control that derives from WebControl. The custom
control assigns other controls dynamically to the Controls collection. Is
there anyway that I can recall the lost of controls that I assigned to my
custom control when I receive postback?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Nov 18 '05 #3
I thought about doing it that way, but it seemed like a lot of redundant
data. I end up sending the same stuff twice to the client. Maybe it isn't
significant enough to worry about it. I was trying to keep my ViewState
data down to a minimum.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Kevin Spencer" <uc*@ftc.gov> wrote in message
news:eF******** ******@TK2MSFTN GP09.phx.gbl...
Keep track of what Controls are being added, and persist that data somewhere (such as ViewState). Then, on PostBack, read from your "list" and re-add the appropriate Controls.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ken Varn" <nospam> wrote in message
news:Oa******** ******@tk2msftn gp13.phx.gbl...
I have created a custom control that derives from WebControl. The custom control assigns other controls dynamically to the Controls collection. Is there anyway that I can recall the lost of controls that I assigned to my custom control when I receive postback?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------


Nov 18 '05 #4
I thought about doing it that way, but it seemed like a lot of redundant
data. I end up sending the same stuff twice to the client. Maybe it isn't
significant enough to worry about it. I was trying to keep my ViewState
data down to a minimum.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Kevin Spencer" <uc*@ftc.gov> wrote in message
news:eF******** ******@TK2MSFTN GP09.phx.gbl...
Keep track of what Controls are being added, and persist that data somewhere (such as ViewState). Then, on PostBack, read from your "list" and re-add the appropriate Controls.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ken Varn" <nospam> wrote in message
news:Oa******** ******@tk2msftn gp13.phx.gbl...
I have created a custom control that derives from WebControl. The custom control assigns other controls dynamically to the Controls collection. Is there anyway that I can recall the lost of controls that I assigned to my custom control when I receive postback?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------


Nov 18 '05 #5
This seems like redundant data. If I put it in ViewState, I am duplicating
the data that is already on the screen. Can I somehow have the controls
post back with the form?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Kevin Spencer" <uc*@ftc.gov> wrote in message
news:eF******** ******@TK2MSFTN GP09.phx.gbl...
Keep track of what Controls are being added, and persist that data somewhere (such as ViewState). Then, on PostBack, read from your "list" and re-add the appropriate Controls.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ken Varn" <nospam> wrote in message
news:Oa******** ******@tk2msftn gp13.phx.gbl...
I have created a custom control that derives from WebControl. The custom control assigns other controls dynamically to the Controls collection. Is there anyway that I can recall the lost of controls that I assigned to my custom control when I receive postback?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------


Nov 18 '05 #6

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

Similar topics

5
1709
by: Jonathan Williams | last post by:
Hi, I have an object which inherits from WebControl (CUSTOM : WebControl) In this object I have code in which I add child contols: protected override void CreateChildControls() { //this.Controls.Clear(); CustomFieldUtil objCustomFieldUtil = new CustomFieldUtil(); DataTable objDT = objCustomFieldUtil.GetDataTable("custom"); for(intCount = 0; intCount < objDT.Rows.Count; intCount++)
3
2651
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
3
251
by: Ken Varn | last post by:
I have created a custom control that derives from WebControl. The custom control assigns other controls dynamically to the Controls collection. Is there anyway that I can recall the lost of controls that I assigned to my custom control when I receive postback? -- ----------------------------------- Ken Varn Senior Software Engineer Diebold Inc.
7
1571
by: Tim | last post by:
I am trying to load both server and user controls into placeholder controls on a aspx template page at runtime. These values would be strings that are returned from a database query. I know I can do this for user controls easily using: oContent = (ControlBase) Page.LoadControl(Session + ".ascx"); this.plcContent.Controls.Add(oContent); but can not figure out how to do it for server controls. since I do not know what the control...
3
1507
by: msnews.microsoft.com | last post by:
Hello All, I am trying to write Web Controls and in most of the samples I came across, I am seeing the following function where a HTML string is written to create HTML Controls. /// <summary> /// Render this control to the output parameter specified.
4
1399
by: antonyliu2002 | last post by:
I am new to the .NET framework. I know this has been discussed many times in this group. I also read extensively here, however, I am in bad luck: none of the sample code provided in this forum worked for me. What I want to do is really simple. I simply want to iterate through all controls of the current page and create session objects for TextBoxes and CheckBoxes.
0
986
by: dustbort | last post by:
ASP.NET 1.1 I want to enhance the existing web controls to add special data-binding features like provider-consumer relationships and the ability to automatically add validation based on database schema. The problem I am having is that most of this functionality is really an extension of the WebControl class, from which the web controls inherit. There is a lot of functionality (properties and methods) that I would like to put into a base...
2
3480
by: ThunderMusic | last post by:
Hi, I have a custom WebControl. I fire an event and send, as the EventArg, another WebControl that contains sub controls (ParseChildren(true))... It can contain anything, but I want to find one control... Let's say the control I want to find is "myControl". So I call e.theObject.FindControl("myControl"); It always returns null and I know the name of the control is good (that's the ID I gave it, is it possible it has changed because it's...
3
1883
by: Jonathan Wood | last post by:
I could really use some help on this. First of all, I want to create a Web control where I render the control completely from scratch based on information from a database. In the book "Beginning ASP.NET 2.0 in C# 2005", it provides an example of doing this, which is declared as: public class ConfigurableRepeater : WebControl.
2
1217
by: Lloyd Sheen | last post by:
Ok I have created a small testbed site for testing and I am have a problem with the terms Usercontrol, Webcontrol, etc. What I need to do in the long run is have a page using AJAX and having dynamically loaded controls on the page. So what I did was first create a page with two buttons. First button will load a Label control into a placeholder. After execution and clicking the button the label shows in the page.
0
9646
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
10350
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...
1
10097
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
8983
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
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
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();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2887
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.