Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 19th, 2006, 12:17 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default ViewState problem when adding a panel to a panel

Hi,

I've got a Panel panel1 and a Panel panel2. panel2 contains a custom Data-Bound control, which enherits from DropDownList. The control contains some values from the database which can be selected.

I want to add panel2 to panel1:
panel1.Controls.Add(panel2);

Now, if I select a value in the custom control and I do a PostBack, the value isn't selected anymore. If I DON'T add panel2 to panel1 and I do a PostBack, the value is still selected.

Does anyone know why the value isn't selected anymore if I add panel2 to panel1? Maybe something goes wrong with the viewstate if I add panel2 to panel1?

Marcel

  #2 (permalink)  
Old February 20th, 2006, 05:02 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

already found the problem :)

thanks

  #3 (permalink)  
Old February 20th, 2006, 05:45 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

For the purpose of the archive, would you mind sharing your solution?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #4 (permalink)  
Old February 20th, 2006, 09:17 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sure,

I forgot to put the method - which fills the custom control - in the "if(!IsPostBack)"-block.....





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a Panel control in FormView steve35719 ASP.NET 2.0 Basics 5 August 18th, 2010 12:32 AM
Actionlister and Panel csharpa C# 0 January 29th, 2007 01:41 PM
Set Panel Visibility Problem niceFEPF C# 2005 0 November 21st, 2006 06:34 PM
Input Panel matt.fields VB Components 3 November 13th, 2003 10:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.