473,466 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

bug in the placeholder control ?

Hi,
I just wanted to discuss about the wierd behavior of placeholder
control. Let me explain the scenario first.
We are building an online loan origination system using ASP.NET. On a
web form we need to provide the functionality to add bank assets/
stock assets and property assets dynamically i.e if the provided input
panels are not enough. So I have created different user controls for
each of these assets, whenever the user clicks on "add new bank
asset", I am adding a new instance of the "bank asset" user control in
the bank assets place holder. Similarly whenever they click on "add
new stock asset", I am adding a new instance of the "stock asset" user
control in the stock assets place holder. I am keeping track of the
additional stocks/ bank accounts/ properties using hidden fields
(since view state is not available in Page_Init). I am adding all
these user controls again to their corresponding place holders in the
Page_Init method. It took me a while to figure out that all these user
controls are following the same ID convention regardless of their base
class. For example if there are two additional bank assets and two
additional stock assets the corresponding generated IDs are ctrl0
,ctrl1, ctrl2, ctrl3 although they are added to different place
holders and for the same reason every time the user clicks on a "add
new" link some of the user controls dont retain their previous IDs
(therefore loose ViewState). I fixed this problem by giving my own IDs
to the user controls depending on their base class and depending on
the place holder to which they are being added to. I just thought it
would have made more sense if the user control client IDs change
depending on their place holder rather than follow a dumb generic
convention which doesnt help. Please let me know of your opinion.
thanks,
Maruthi Tanneru
Nov 18 '05 #1
1 1181
>I am keeping track of the
additional stocks/ bank accounts/ properties using hidden fields
(since view state is not available in Page_Init).
You don't have to do this. On the first request of your page, IsPostBack =
False, you draw your initial view. Then on subsequent postbacks you override
loadviewstate method which is only called on postbacks, call Base
LoadViewState, then draw your postback view using viewstate. LoadViewState
method happens right after init method but before the load user post back
data method.
"Maruthi" <tm******@hotmail.com> wrote in message
news:d6**************************@posting.google.c om... Hi,
I just wanted to discuss about the wierd behavior of placeholder
control. Let me explain the scenario first.
We are building an online loan origination system using ASP.NET. On a
web form we need to provide the functionality to add bank assets/
stock assets and property assets dynamically i.e if the provided input
panels are not enough. So I have created different user controls for
each of these assets, whenever the user clicks on "add new bank
asset", I am adding a new instance of the "bank asset" user control in
the bank assets place holder. Similarly whenever they click on "add
new stock asset", I am adding a new instance of the "stock asset" user
control in the stock assets place holder. I am keeping track of the
additional stocks/ bank accounts/ properties using hidden fields
(since view state is not available in Page_Init). I am adding all
these user controls again to their corresponding place holders in the
Page_Init method. It took me a while to figure out that all these user
controls are following the same ID convention regardless of their base
class. For example if there are two additional bank assets and two
additional stock assets the corresponding generated IDs are ctrl0
,ctrl1, ctrl2, ctrl3 although they are added to different place
holders and for the same reason every time the user clicks on a "add
new" link some of the user controls dont retain their previous IDs
(therefore loose ViewState). I fixed this problem by giving my own IDs
to the user controls depending on their base class and depending on
the place holder to which they are being added to. I just thought it
would have made more sense if the user control client IDs change
depending on their place holder rather than follow a dumb generic
convention which doesnt help. Please let me know of your opinion.
thanks,
Maruthi Tanneru

Nov 18 '05 #2

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

Similar topics

2
by: Mike Speak | last post by:
I have a user control that I want to use to render 4 menu items (retrieved from db) on the top of each of my asp.net pages. The user control defines a table, with one TR and one TD. Within the...
1
by: Dan | last post by:
I have an asp.net page default.aspx with a user control and a placeholder control. <html> <body> <form id="myform" method="post" runat="server" /> <PageHeader:Header id="header1"...
0
by: shark | last post by:
I have a placeholder in a control that is in turn, used as a control in a placeholder in a form. I am getting a viewstate error so I believe I have to clear my placeholder before I load the...
5
by: studio60podcast | last post by:
I have an ASP:Placeholder and I'm trying to populate with Label controls from the code behind after a button click, essentially creating a list of selections. But each time I click the button,...
6
by: David Colliver | last post by:
Hi, using vb.net 1.1 I am trying to add a control to a placeholder but am having problems with it. I do it practically the same way as i do in C# (I have more C# skill than VB.NET)and I...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
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...
0
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...
0
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...
0
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...
0
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 ...

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.