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

0
KeysMan
6/6/2006 6:45:39 PM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

5 Replies
1918 Views

Similar Articles

[PageSpeed] 20

hello.

well, what you can do is get a reference to the placeholder where your user control is being loaded. then you can remove your 1st user control and add the new one.


--
Regards,
Luis Abreu
email: labreu_at_gmail.com
EN blog:http://msmvps.com/blogs/luisabreu
0
Luis
6/6/2006 9:42:07 PM
Thanks a lot. But i can't seem to figure out how to get it to work inside the update panel. Could you plees give a code example?

My best regards
0
KeysMan
6/9/2006 4:13:08 PM

hello.

not suer if this is your scenario, but it should point you in the right direction (as allways, there are other ways of doing this):

user1.ascx

<%@ Control Language="C#" ClassName="user1" %>
<%@ Reference VirtualPath="user2.ascx" %>

<script runat="server">
    void handle(object sender, EventArgs args)
    {
        Page page = this.Page;
        Control ctl = page.FindControl("holder");
        ctl.Controls.Add(this.LoadControl("user2.ascx"));
        ctl.Controls.Remove(this);
    }
</script>
<span>user control 1</span>
<asp:Button runat="server" ID="bt" Text="Change to 2" OnClick="handle" />

user2.ascx

<%@ Control Language="C#" ClassName="user2" %>

<script runat="server">

</script>
<span>Control 2</span>

userpage.aspx

<%@ Page Language="C#" %>
<%@ Register Src="~/user1.ascx" TagName="user" TagPrefix="pr" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <atlas:ScriptManager runat="server" ID="manager" EnablePartialRendering="true" />
        <atlas:UpdatePanel runat="server" id="panel">
            <ContentTemplate>
                <asp:Panel runat="server" ID="holder">
                    <pr:user runat="server" id="usr" />
                </asp:Panel>
            </ContentTemplate>
        </atlas:UpdatePanel>
    </div>
    </form>
</body>
</html>


--
Regards,
Luis Abreu
email: labreu_at_gmail.com
EN blog:http://msmvps.com/blogs/luisabreu
0
Luis
6/10/2006 10:21:04 AM
Thanks a lot.
0
KeysMan
6/10/2006 11:26:53 AM

Hi,

 I have a similar kind of issue. My user control has a dropdownlist and list box based on the property DisplayControl set , either dropdown list or list box will be displayed in the calling page.

I am placing this user control inside a gridview - Edit item template and Gridview is placed inside an updatePanel. This way control is working fine, but the update becomes really slow (around 5min).

Any suggestion to solve is appreciated.

 Thanks and Regards


Prabhavathi
0
prabavathinew
8/31/2007 11:54:49 AM
Reply:

Similar Artilces:

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...

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...

WEB Spell Checker does not work in Web User Control and WEB HTML Editor freezes when using AJAX Update Panel
Web Spell Checker works in program but only causes a refresh in Web User Control. The HTML Editor is frozen after the refresh. App also uses AJAX control and the Web User Control is inside an Update Panel Hi, Thank you for your post! I'm afraid that you cann't use WEB Spell Checker in updatepanel because it include some inline javascript with it, but updatepanel doesn't support very well inline javascript in it. For more information about inline javascript in updatepanel, see UpdatePanel and Rendered (Inline) Javascript It seems that the UpdatePanel essentia...

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 ...

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 ...

Updating a Label control in one user control from another user control
Hi all, I have a main page in my music store site that has 5 user controls on it with 1 always showing main content and the others being things like a shopping cart, "best sellers", genre list etc (a la amazon). From the main content control I want to be able to set some label controls in my shopping basket control but I just can't seem to work out the syntax for how to do this: Here's the code I'm using - I'm trying to go to the 4th user control on the page (my shopping basket) then find the appropraite label, cast it locally as a Label then update the value: Label _so...

Web parts , Web User Control, Update Panel, Javascript
Hi guys,  Hope this time someone replies first of all, Is that possible to combine all above Asp.net and Ajax controls?      The below one is my web user control code which I am using in the webpart zone. <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>   <asp:Panel ID="EditContainer" runat="server" DefaultButton="btnSubmit" > Start Date: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> End Date:&nbsp;&nbsp;<asp:TextBox ID="TexBox2" runat="server"></asp:TextBox> <asp:Butt...

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 ...

Updating a User Control from another User control
I have a web page that has three frames: Header, Nav, and Content. In the header frame, I have a user control for the breadcrumb text (something like "Home : Cases : Jones Case : Contacts") that needs to be updated based on information sent from another user control which is in the Content frame. Is this possible?...

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...

How to use a web user control from one web app in another web app?
I have a production web app project (at work) that has custom web user controls in it.I have another web app project for experimenting and I want to use some web controls from the production web app. The big trick is that I need to load the controls dynamically.LoadControl() doesn't seem to work - it complains about loading controls from a different application. I also tried adding a project reference to the production web app and using "UC1 newUC = new UC1();" and then "this.Controls.Add(newUC);", but the controls (like TextBoxes) on the web user control don't seem to exist on the new UC1s....

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...

Web resources about - Web user control inside update panel replace with another web user control - asp.net.ajax-discussion

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Obama may be able to do something on gun control at last: reports
US President Barack Obama is expected to announce executive actions expanding background checks on gun sales.

President Barack Obama to impose new gun controls next week
President Barack Obama will press ahead with a set of executive actions on guns next week despite growing concerns in the US that have dampened ...

Gun control: Barack Obama plans to bypass senate, push through executive action on gun control
Barack Obama will meet with Attorney-General Loretta Lynch to discuss ways of reducing gun violence through measures that do not require congressional ...

Disable Windows 10 upgrade prompts with GWX Control Panel 1.7
... then the constant "Get Windows 10!" alerts are probably getting annoying. Fortunately you can disable them in seconds with the free GWX Control ...

Obama Meeting with Attorney General to Finalize Executive Gun Control
President Obama will meet with Attorney General Loretta Lynch to finalize the executive gun controls expected to be announced next week.

Thinga is a kid-friendly search engine with parental controls
Keeping kids away from questionable content while they surf the web is an ongoing battle, and there's a new site that's looking to help. Thinga, ...

Make 2016 The Year You Take Control Of Your Email
Start your New Year's Rev-olutions off right by getting a handle on that unruly inbox.

NEW YEAR, NEW RULES Obama reportedly will use exec actions to tighten gun control
NEW YEAR, NEW RULES Obama reportedly will use exec actions to tighten gun control

PHOTOS: Hot To Trot Hunks Can Hardly Control Themselves In Brussels
PHOTOS: Hot To Trot Hunks Can Hardly Control Themselves In Brussels

Resources last updated: 1/2/2016 10:52:31 AM