Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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

Reply With Quote
  #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

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

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

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #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.....



Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:08 PM.


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