473,791 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Persisting child controls

Hi,

I've made a collapsible panel custom control. It's pretty simple so far, it
extends the Panel class and renders a bar above itself (panel) to show/hide
the <div> of the panel on the client-side using DHTML. So far it works fine.

I want to be able to make it work server-side as well: only the topbar is
rendered if the panel is to be collapsed and the topbar AND the panel are
rendered if the panel is to be expanded. But when I do that (hide and show
the panel), the properties of the child controls are not persisted.

Any hint on how I might do this?

Thank you,
Nov 18 '05 #1
1 929
Use ViewState.

In a custom Server Control, this is absurdly easy to do. You create a
Property, something like the following:

public String PersistedProper ty
{
get
{
if (ViewState["PersistedPrope rty"] == null) return "Default Value";
return Convert.ToStrin g(ViewState["PersistedPrope rty"]);
}
set
{
ViewState["PersistedPrope rty"] = value;
}
}

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

"Alexandre Soares" <so*********@ho tmail.com> wrote in message
news:e5******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I've made a collapsible panel custom control. It's pretty simple so far, it extends the Panel class and renders a bar above itself (panel) to show/hide the <div> of the panel on the client-side using DHTML. So far it works fine.
I want to be able to make it work server-side as well: only the topbar is
rendered if the panel is to be collapsed and the topbar AND the panel are
rendered if the panel is to be expanded. But when I do that (hide and show
the panel), the properties of the child controls are not persisted.

Any hint on how I might do this?

Thank you,

Nov 18 '05 #2

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

Similar topics

3
1368
by: Tom | last post by:
Hi, I am looking for an article or tutorial on persisting winform user input for the life of the app. How to design it? For instance, do I create a container class specific to each form? This data will need to be accessed throughout the application and then be persisted to a xml file. Any ideas? Thanks
1
2151
by: Diane Yocom | last post by:
I'm still very new to ASP.Net, so wanted to get some advice on how to solve the following design problem (sorry my explanation is so long): I'm developing an ASP.Net intranet app (using VB.Net for my business objects) that will allow my users (max of about 25) to enter information about families and their children. On one page, I need to collect general information about the family (such as address and phone number) and specific...
3
2272
by: Stu | last post by:
Hi, I am creating a control in a PlaceHolder like so: Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim ctrl As AcceptOrCancel = CType(Page.LoadControl("controls/AcceptOrCancel.ascx"), AcceptOrCancel) PlaceHolder1.Controls.Add(ctrl)
10
4030
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
0
244
by: john_teague | last post by:
I appologize for the cross-posting, but I received no responses from the building controls group. I have a custom control that inherits from a DataGrid control. I have a property that has an arraylist of strings. I want to add items as a child tag of the grid. How is the best way to do this. Here is what I have as of now.
2
3277
by: xenophon | last post by:
I added a Hidden Form Field to a form in the code behind. The value is being set in JavaScript client-side, but it is not persisting to the server in the PostBack. I know the value is being set properly because it displays in the document.write method. Create a simple page and paste the below in the code-behind (ASP.NET 1.1-SP1) using System;
5
4840
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
10
1601
by: Allan Ebdrup | last post by:
I have a custom server web control that inserts another custom web server control in a templated child control (a wisard that inserts a header in its wizardstep) Now after switching to design view and back the header is inserted in the aspx page's xml. I don't want this because then yet another header is inserted when I switch to design view again. I've tried looking through the attributes you can set on a component but I can't find...
0
2097
by: Homer J. Simpson | last post by:
A few weeks ago I asked for suggestions on how to persist a tree's node state to cookies, without causing postbacks on each click in the tree. I had a single .aspx file, with a row of buttons on top of the screen, and a tree control below (with EnableViewState set to true). I let the user expand/collapse away to his hearts content without needless roundtrips. When the user clicked on a button at the top, I'd reload the page, check...
0
9666
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
9512
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
9987
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...
1
7531
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
5424
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
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
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
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
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.