swapping web user controls

I have a complicated page, but here is a simple example to show my problem.

I have two web user controls that are being loaded, each with buttons and other asp tags. These are loaded in a certain order. The user, if he/she decides, can swap the order by pressing a button on the page.
My problem, when the user presses the button, the web user controls swap, but anything that was done inside them is lost, i.e. their state is lost.
Can anyone tell me a method of saving their state so that the changes are not lost. I have already tried enableviewstate, but that does not work.
Jagdip
Intelligence is a burden.
Jagdip Singh Ajimal
Manchester (and yes, I am a Manchester United fan)
0
jagdipa
8/6/2003 11:10:44 AM
asp.net.state-management 8807 articles. 0 followers. Follow

2 Replies
935 Views

Similar Articles

[PageSpeed] 31

The state is lost because when you remove the user control from the control tree and re-add it back into a different position or a different ControlCollection, the ControlCollection class re-initializes the user control as if it was brand new. Since it is in a different position, the viewstate does not match up and it is discarded.

I've been searching for a way to manually load viewstate into a particular control for quite a while, and have yet to find a solution.
0
RMD
8/6/2003 7:15:46 PM
I think I have a way around this problem.

I am planning on loading all my controls into an array, with the viewstate enabled. Then I will save this to a session, and load the controls from there. Hopefully, this will save the viewstate when I move the controls around. And if it doesnt, I may be able to find a method that does it.
HTH
Jagdip
Intelligence is a burden.
Jagdip Singh Ajimal
Manchester (and yes, I am a Manchester United fan)
0
jagdipa
8/7/2003 8:42:33 AM
Reply:

Similar Artilces:

Web User Control to Web User Control...
Hi, I have 2 User controls on a page and want Control1 to call a method of Control2. Is this Possible? Example: Con1 = Datalist showing products, each with a Quantity Box and a Button. Con2 = Repeater showing Cart Preview (name, Price) in page.aspx. When I click on the button on the DataList in Con1 it adds the item into the Session based Cart. However it does not update the Cart Preview. I need to call BindPreview() in Con2 in order to update the Cart Preview... Does that make sense? argh! any help much appreciated! PeteWeb Design Nottingham, UK Well I can call BindPreview() from m...

access controls on web user control x from web user control Y
I have 2 web users controls in a page and I would like to get or set the selected values of a few dropdown boxes on web user control X from web user control Y and I also would like to know how to access functions that are on a web user control X from a web user control Y, is this possible? How can I do it? User can access and set the values of the User Control from .aspx page through properties,using javascript and in code-behind of aspx page.The details of it are shown below Using PropertiesIf the Sample.ascx control has two textboxes and submit button.You can access the valu...

Control state on Web User control
Hey I am using using Asp.net 2.0 with C# trying to code two Web user controls.  I am entering data into a textbox on UserControl1.ascx and trying to store the data on Userontrol2.ascx on a Default.aspx page.   Here is my Page_Load event for the UserControl2.ascx if (!string.IsNullOrEmpty(Session["criteria"].ToString())) { lblCriteria.Text = Session["criteria"].ToString();  Session.Remove("criteria");  } if (!string.IsNullOrEmpty(Session["study"].ToString()))  {  lblStudy.Text = Session["study"...

Persisting data in a web user control, which contains a list of other web user controls.
 Hi All, I have a control I've created, which can have a number of child controls - also user controls - stored as an ArrayList, which can be added wither a design time or programmatically.My problem is when I add to the list programmatically, it doesn't persist them. So if I add 3 child controls in step 1 of a wizard, with the aim that those three will be visible inside the parent in step 3, what happens is that the parent has no child controls and the item count is 0.Can anyone help? Thanks in advance.Code:Parent Control Markup: <%@ Control Language="C#" Auto...

web controls and web user control
i have a problem in a web form , I have a webform that contains a web user control which in turn contains a html input form ,the web control events don't fire up ,When I click button ,no effect ,I don't know what is the effect of the html form which is in the web user control on the web controls in the web form ?? can any one help me the web control event should be handle in the code behind page, is the event handler for the button you are clicking registered? You can try double clicking the button, should give you the default btn_click event handler in code behind. Also, make ...

Web user control inside update panel replace with another web user control
 Hi there. I have a page with a menu. an and then the content. My thing is. That i have the update panel, and inside that i have a regual panel in which i add the Web User Controls i need. Which all works fine. My problem is. That i i have a submit funcion on almoast all the Web User controls. What i would like is that i inside that update panel, can dispose the original Web user Control and then add a response Web User Control. In normal language. Is there a way that i can load one web user control into antoher and then disposose the original? Thanks in advance hello. well, what ...

User Control VB.Net x Web Custom Control
I was thinking in create a user control in VB.Net, and use it in a Asp.Net as possible? So I thought about it is gonna be better than make a Web Custom Control, so i thought again, nope... But i need to know better because a don't have a progress bar in asp.net for example.... Could Somebody tell me about??? in a reallity i know the asnwer but i would like to explain by myself... Thank's Antonio...

How to validate controls on a .NET 2.0 Web user Control
Hi Guys, (ASP.NET 2.0 / C#) I've looked thorugh every post on validating web user controls (and know about Pter Blum's Professional Validation and More package) - but can't seem to get my head around whre to start. I have a web user control, called wucICL.ascx on a we page called AddEditInvestment.aspx.  I would like to validate a couple of DropDownLists (ddlAccounts and ddlContacts) when the Insert and Update buttons are clicked on the AddEdit Investment page. The other controls on the AddEditInvestments page belong to a validation group called All Validators and the DropDownL...

Single page with multiple user web controls VS Multiple page with specific user web controls
I have a question regarding single page with multiple user web controls vs multiple page with specific user web controls   Option 1: I am of the opinion to have multiple pages with specific user web controls and use an object to store all the information as the user navigates through the application. And finally at the end, read this object and save all the information to the backend database.   Option 2: My respected team member suggests that we have only one page, with all the specific user web controls and not use an object, instead show/hide the user web controls based ...

I have a web user control being used by another web user control, but the one being used will not display the labels in the resx file.
I am using DotNetNuke version 3.13 (might be 3.013) on a Window's XP machine, SP2. I have what I find to be an extremely odd situation. I have a project called TDS.Controls. This project is a web control library. Each control has its own resx file, which is located in the App_LocalResources directory. Each control inherits from Framework.UserControlBase, just like DotNetNuke's User control in DNN\Controls\User.ascx.vb. As a matter of fact, this control is doing the exact same thing I am trying to do. It is a web user control with its own resx file being used by another web user control (See ...

UpdatePanel within a web user control resets data of controls outside the user control
Hello, I have a usercontrol on my page which displays a running marquee text. It makes use of an UpdatePanel (within the user control) to refresh the marquee text (within the updatepanel) at periodic intervals. For this I added a timer control and its tick event as an async postback trigger for the UpdatePanel. I have a lot of textboxes and dropdown list boxes (all with runat=server) on the page outside the above user control. These are also contained in different UpdatePanels. Problem is, when the user control does a postback to refresh the marquee text, it causes some of...

Javascript inside "web user control" not run if load "web user control" under ajax UpdatePanel
I have this problem and please if some can help me, I place here a sample code to see, but in my real problem the web user control have a very complicate javascript. I have a web user control that have some javascript inside, let say for example.1 <script type="text/javascript" > 2 function RunMe() 3 { 4 alert("Client id:<%=ClientID%>"); 5 } 6 </script> 7 8 9 <a href="javascript:RunMe()">Run javascript</a> a simple call to a simple javascript, inside the web user control And now I have...

User Control Within UserControl
If I have a user control A and then inside it a user control B embedded/referenced within it.  User Control A has a panel defined (cpeNewUser) that I want to manipulate from the code behind of User Control B based on some event that happens.So putting this in my code behind of User Control B won't work as it has no idea of cpeNewUser:cpeNewUser.Collapsed = true;So is it because only at runtime they are married up and because of this you cannot access each other's objects at compile time?  How would I get this to work becuase I'm using all user controls inside a AJAX Too...

Use Web Custom control or Web User control?
Friends,  I have a generic aspx page and its functions which is used in many .NET web application. The generic page contains a HTML Div control, server drop down list, server buttons, server textbox and it have different server and client functions to do its tasks for calling aspx pages in web applications. My problem is I do not know whether I should make that generic page as a web user control (but this is tedious because all other application folders must store frontpage aspx and code behind files of the generic page) or as a web custom control (This seems to be good beca...

Server Web User Control or Web Custom Control
Ok, I made a DataGrid I like, stuck it in a Web Control Lib, and then to my toolbar. Now I want to take my nice little control and add it to a greater control, maybe place some buttons around it etc. I could always inherit from it in a new custom control and dynamically add the buttons, but I thought about using a Web User Control. I thought I could easily create a Web User Control, drop on my grid and the buttons on a form, and expose some properties and events, but once I got into it, I got a feeling that this isn't what a Web User Control is for. When designing a control li...

Web resources about - swapping web user controls - asp.net.state-management

Hot swapping - Wikipedia, the free encyclopedia
Hot swapping and hot plugging are terms used to describe the functions of replacing computer system components without shutting down the system. ...

Facebook Swapping Out Credits, Adding Subscription Billing
Facebook announced Tuesday that the company is doing away with Facebook Credits and transitioning to local currency. The social network also ...

Book swapping - Flickr - Photo Sharing!
Books gathered and donated to be swapped. Rule of the game is you give a book to the pool and take one. This is meant so peoples could more easily ...

Toni Collette Talks About Swapping Roles With Drew Barrymore in ‘Miss You Already’ - YouTube
Director Catherine Hardwicke, actress Toni Collette and writer Morwenna Banks give us details on their new film "Miss You Already" Director Catherine ...

Swapping collectables ... and yarns too - Bendigo Advertiser
Bendigo's Swap Meet represents 39 years of passionate memories for its founder.

House Swaps - Save Money On Accommodation - House Swapping
Daniel Scott takes advantage of an increasingly popular way to save on holiday accommodation while living like a local: house swapping.

House-swapping site for creatives only
Creative, house-proud globetrotters finally have their own home-swapping social media network.

Cops clamp down on demerit point swapping
Police expect they will lay charges against scores of West Australian drivers as part of a crackdown on rorting of the demerit point system. ...

Knights, Raiders consider swapping Naiqama and Harrison
Knights, Raiders consider swapping Naiqama and Harrison

280: Beeps, shift swapping, the myth of genius and more
Watch your writing process in instant replay. Does your email address age you? Living in a world of beeps. The perception of genius. Why creativity ...

Resources last updated: 12/22/2015 7:32:24 AM