473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Confusion Over Postback, ViewState and Dynamically Added Controls

Hi there:

I've checked the forums, but haven't found a situation addressing my
specific problem. Here's the deal:

I've got a Web Form containing two Panel controls. One displays search
results in a DataList comprised mainly of LinkButtons. The other's basically
empty; it's intended to handle a collection of dynamically added controls.

When the user clicks a LinkButton from within the first Panel control, I
want to be able to take the argument passed by that click and add, to the
second Panel control, an IFRAME tag with a reference to load from a URL based
on what the user clicked. This panel should be able to contain one 'n'
IFRAME tags.

The problem I'm having is that with each PostBack, the Panel that's supposed
to contain the "Controls.Add"-ed IFRAME tags only contains the one requested
by the most recent PostBack. Instead of creating the running, cumulative
collection of IFRAMEs with each LinkButton click that I'm looking for, the
Panel dumps everything and starts over with what was just requested.

I understand this probably has something to do with Page.Load and ViewState,
but I'm unclear as to how to address it specifically. Please help!

Thanks much,
Chris
Nov 19 '05 #1
1 1439
I posted a sample a while back on how to do this:

http://groups-beta.google.com/group/...717a97bd32c450

It's not doing exactly what you want, but the main thing is that you need
to recreate the controls upon every postback.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi there:

I've checked the forums, but haven't found a situation addressing my
specific problem. Here's the deal:

I've got a Web Form containing two Panel controls. One displays
search results in a DataList comprised mainly of LinkButtons. The
other's basically empty; it's intended to handle a collection of
dynamically added controls.

When the user clicks a LinkButton from within the first Panel control,
I want to be able to take the argument passed by that click and add,
to the second Panel control, an IFRAME tag with a reference to load
from a URL based on what the user clicked. This panel should be able
to contain one 'n' IFRAME tags.

The problem I'm having is that with each PostBack, the Panel that's
supposed to contain the "Controls.Add"-ed IFRAME tags only contains
the one requested by the most recent PostBack. Instead of creating
the running, cumulative collection of IFRAMEs with each LinkButton
click that I'm looking for, the Panel dumps everything and starts over
with what was just requested.

I understand this probably has something to do with Page.Load and
ViewState, but I'm unclear as to how to address it specifically.
Please help!

Thanks much,
Chris


Nov 19 '05 #2

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
1
by: Craig Buchanan | last post by:
i am building a webform that dynamically loads one of two web usercontrols during the webform's page_load event. during the postback i reload the appropriate web usercontrol. so far so good. ...
10
by: Krista Lemieux | last post by:
I'm new to ASP.NET and I'm not use to the way things are handled with this technology. I've been told that when I have a control, I should only bind the data to it once, and not on each post back...
1
by: John Cosmas | last post by:
I've got a page which loads up a different user control into a placeholder control every time a button is clicked on the parent page. I use a statement like...
2
by: Jarod | last post by:
Hey I change backColor of linkButton in my Page_Load: lbDoSth.BackColor = Color.Red; But I have multiView on this page. On one of the views I have detailsView. When I add a new row a set...
4
by: Gregory Gadow | last post by:
If there is a more appropriate forum, please let me know and I will post there. Our field reps can go on to our website and select from several sets of data to create the address we then provide...
3
by: Ben Dewey | last post by:
Okay, so I have a base Page class called ArticlesPageBase. This base class has reads in an overridable ArticleId and Loads the data into a Panel object in the ContentPlaceHolder of the Master. ...
1
by: RSH | last post by:
Hi, I am experimenting with the Viewstate and based on a few articles I have read, I put together a test. it is a simple test where I am dynamically creating a DropDownList that contains 25000...
0
by: nithagowda | last post by:
Hello, I have a DropDownList for source type and a panel for displaying TreeView based on the source type.. The problem is- if i select different source type drom ddlSrcType, other than the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.