473,769 Members | 5,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent : Dynamic user controls (PLEASE)

Hi all,

I have posted this type of question quite a few times but to date, no-one
has actually been able to provide me with a solution. I really need to
understand how to do this properly.

My situation:
I have n user controls which, based on user input, interchange with a
placeholder on a web form.

My problem:
Using the LoadControl function, my dynamic user controls are not maintaining
their state upon the first postback. If the same control is being loaded the
2nd time, then the viewstate is fine.

I understand that I need to re-load the user controls (i.e. LoadControl)
upon a postback to obtain the correct viewstate so as to get to the values
the user entered from the screen. I cannot simply paste the user controls
onto the webform and then set the visibility based on a variable because
there are just too many user controls.

Please could someone help me with this so I can understand it clearly and
move on to other exciting .NET-related things. I really need closure on
this. . .
Regards
John.
Nov 18 '05 #1
4 1571
John,
I'll do my best to help you, but I'm not sure I even see a question in
there. You seem to have an understanding of how it works...that's just how
it is. An alternative would be not to reload the user controls and check
Request.Form which will have the values entered even if you don't reload the
controls.

Anyways, please describe your problem in more detail and I'll do what I
can..

Karl

"John" <a@b.com> wrote in message
news:O5******** ******@TK2MSFTN GP14.phx.gbl...
Hi all,

I have posted this type of question quite a few times but to date, no-one
has actually been able to provide me with a solution. I really need to
understand how to do this properly.

My situation:
I have n user controls which, based on user input, interchange with a
placeholder on a web form.

My problem:
Using the LoadControl function, my dynamic user controls are not maintaining their state upon the first postback. If the same control is being loaded the 2nd time, then the viewstate is fine.

I understand that I need to re-load the user controls (i.e. LoadControl)
upon a postback to obtain the correct viewstate so as to get to the values
the user entered from the screen. I cannot simply paste the user controls
onto the webform and then set the visibility based on a variable because
there are just too many user controls.

Please could someone help me with this so I can understand it clearly and
move on to other exciting .NET-related things. I really need closure on
this. . .
Regards
John.

Nov 18 '05 #2
Hi Karl,

I think I sorted it out - EVENTUALLY!

It seems as thought the main problem I was having was a lack of
understanding regarding the Page life cycle. The reloading I was doing was
placed in the Page_Load event as opposed to the Page_Init event so the
Viewstate was indeed being restored correctly but I was ovewriting it again
with the initial values.

Thanks for the help. Now I can check out the printing and PDF-related stuff.

Incidentally, what is the norm for printing over the internet. Any rules to
conform to?

Regards
John.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:#E******** ******@TK2MSFTN GP14.phx.gbl...
John,
I'll do my best to help you, but I'm not sure I even see a question in
there. You seem to have an understanding of how it works...that's just how it is. An alternative would be not to reload the user controls and check
Request.Form which will have the values entered even if you don't reload the controls.

Anyways, please describe your problem in more detail and I'll do what I
can..

Karl

"John" <a@b.com> wrote in message
news:O5******** ******@TK2MSFTN GP14.phx.gbl...
Hi all,

I have posted this type of question quite a few times but to date, no-one has actually been able to provide me with a solution. I really need to
understand how to do this properly.

My situation:
I have n user controls which, based on user input, interchange with a
placeholder on a web form.

My problem:
Using the LoadControl function, my dynamic user controls are not

maintaining
their state upon the first postback. If the same control is being loaded

the
2nd time, then the viewstate is fine.

I understand that I need to re-load the user controls (i.e. LoadControl)
upon a postback to obtain the correct viewstate so as to get to the values the user entered from the screen. I cannot simply paste the user controls onto the webform and then set the visibility based on a variable because
there are just too many user controls.

Please could someone help me with this so I can understand it clearly and move on to other exciting .NET-related things. I really need closure on
this. . .
Regards
John.


Nov 18 '05 #3
There are no special rules for printing..altho ugh sometimes it can be a
pain. You might want to get familiar with CSS for printing:
http://www.blooberry.com/indexdot/cs...ndex/print.htm

Also, something useful to know, you can have a CSS that'll only get used
when printing, do this by specifying media="print" in the <link> or <Style>
tag:
http://www.webdesignschoolreview.com/css-printing.html

Karl

"John" <a@b.com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Hi Karl,

I think I sorted it out - EVENTUALLY!

It seems as thought the main problem I was having was a lack of
understanding regarding the Page life cycle. The reloading I was doing was
placed in the Page_Load event as opposed to the Page_Init event so the
Viewstate was indeed being restored correctly but I was ovewriting it again with the initial values.

Thanks for the help. Now I can check out the printing and PDF-related stuff.
Incidentally, what is the norm for printing over the internet. Any rules to conform to?

Regards
John.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:#E******** ******@TK2MSFTN GP14.phx.gbl...
John,
I'll do my best to help you, but I'm not sure I even see a question in
there. You seem to have an understanding of how it works...that's just

how
it is. An alternative would be not to reload the user controls and check
Request.Form which will have the values entered even if you don't reload

the
controls.

Anyways, please describe your problem in more detail and I'll do what I
can..

Karl

"John" <a@b.com> wrote in message
news:O5******** ******@TK2MSFTN GP14.phx.gbl...
Hi all,

I have posted this type of question quite a few times but to date, no-one has actually been able to provide me with a solution. I really need to
understand how to do this properly.

My situation:
I have n user controls which, based on user input, interchange with a
placeholder on a web form.

My problem:
Using the LoadControl function, my dynamic user controls are not

maintaining
their state upon the first postback. If the same control is being loaded the
2nd time, then the viewstate is fine.

I understand that I need to re-load the user controls (i.e.
LoadControl) upon a postback to obtain the correct viewstate so as to get to the

values the user entered from the screen. I cannot simply paste the user controls onto the webform and then set the visibility based on a variable because there are just too many user controls.

Please could someone help me with this so I can understand it clearly and move on to other exciting .NET-related things. I really need closure on this. . .
Regards
John.



Nov 18 '05 #4
Thanks Karl - I'll check it out . . .

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:O5******** ******@TK2MSFTN GP09.phx.gbl...
There are no special rules for printing..altho ugh sometimes it can be a
pain. You might want to get familiar with CSS for printing:
http://www.blooberry.com/indexdot/cs...ndex/print.htm

Also, something useful to know, you can have a CSS that'll only get used
when printing, do this by specifying media="print" in the <link> or <Style> tag:
http://www.webdesignschoolreview.com/css-printing.html

Karl

"John" <a@b.com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Hi Karl,

I think I sorted it out - EVENTUALLY!

It seems as thought the main problem I was having was a lack of
understanding regarding the Page life cycle. The reloading I was doing was
placed in the Page_Load event as opposed to the Page_Init event so the
Viewstate was indeed being restored correctly but I was ovewriting it

again
with the initial values.

Thanks for the help. Now I can check out the printing and PDF-related

stuff.

Incidentally, what is the norm for printing over the internet. Any rules

to
conform to?

Regards
John.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:#E******** ******@TK2MSFTN GP14.phx.gbl...
John,
I'll do my best to help you, but I'm not sure I even see a question in
there. You seem to have an understanding of how it works...that's just
how
it is. An alternative would be not to reload the user controls and check Request.Form which will have the values entered even if you don't
reload the
controls.

Anyways, please describe your problem in more detail and I'll do what
I can..

Karl

"John" <a@b.com> wrote in message
news:O5******** ******@TK2MSFTN GP14.phx.gbl...
> Hi all,
>
> I have posted this type of question quite a few times but to date,

no-one
> has actually been able to provide me with a solution. I really need to > understand how to do this properly.
>
> My situation:
> I have n user controls which, based on user input, interchange with a > placeholder on a web form.
>
> My problem:
> Using the LoadControl function, my dynamic user controls are not
maintaining
> their state upon the first postback. If the same control is being

loaded the
> 2nd time, then the viewstate is fine.
>
> I understand that I need to re-load the user controls (i.e. LoadControl) > upon a postback to obtain the correct viewstate so as to get to the

values
> the user entered from the screen. I cannot simply paste the user

controls
> onto the webform and then set the visibility based on a variable because > there are just too many user controls.
>
> Please could someone help me with this so I can understand it
clearly and
> move on to other exciting .NET-related things. I really need closure

on > this. . .
>
>
> Regards
> John.
>
>



Nov 18 '05 #5

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

Similar topics

8
5264
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is developing a web-based application, one part of which involves allowing the user the ability to page through transaction "history" information. The _summary_ history table will have the following fields: ServiceName, Date, User-Ref1, User-Ref2,...
1
7587
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
2
388
by: hb | last post by:
Hi, I have a page that uses dynamic generated web user control. On the eupdate.aspx, I get: === <asp:table id="tblE" runat="server"> <asp:tablerow id="rE" runat="server"> <asp:tablecell id="cE" runat="server" /> </asp:tablerow> </asp:table>
13
3674
by: Chris Thunell | last post by:
I have created several grids dynamically and have added them to different HTML placeholders on a vb.net web form. The grids and controls within them come up and view beautifully when the web page first starts, but when I click on a button, and the page comes back, my dynamically created grid and controls are not visible. Any thoughts? Please view my sample code below. If Not ispostback then creategrids end if
2
1145
by: Raghu Raman | last post by:
Hi, In my asp .net page am using many controls and a grid.i populate many html controls innside the grid dynamically .if i click the grid ,it wll go to other page using onclick client side javascript function. I,want my grid data to be maintained in cache when i click the html button. before going to that page i want to cache my page data,so that i can
7
1936
by: John | last post by:
Hi all, I need finality on this once and for all please. I have a main page which contains a couple of placeholders and within these placeholders, depending on what the user presses, I load different user controls. This loading of user controls is done within the code-behind of the main page. The problem is that before loading a user control in place of another, I need to do a Controls.Add then a Controls.Remove so the viewstate is...
16
2965
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In: http://www.mywebsite.org/WebResource.axd?d=5WvLfhnJp5Lc8WhQSD4gdA2&t=632614619884218750 -------------------------------------------------------------------------------- System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed. at...
9
3628
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have to create the dynamic controls in the OnInit stage of the lifecycle. Since data from static controls is not yet available in the OnInit stage I can't know what dynamic control I have to create.
4
51672
Frinavale
by: Frinavale | last post by:
Introduction Sometimes, when developing web applications, we need to be able to dynamically load controls based on user selections. The following article describes a simple scenario where TextBox controls need to be dynamically loaded according to user input. This simple example can be further extended to dynamically load custom web user controls. Background Please familiarize yourself with the ASP.NET Page Life Cycle. It is crucial to...
0
9589
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
9423
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
10212
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9995
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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
7410
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
6674
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
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...
3
2815
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.