Advertisement

03.02.2008 at 08:20AM PST, ID: 23207581
[x]
Attachment Details

User Control Disappears After PostBack

Asked by cristianormoraes in Visual Studio .NET 2005, Microsoft Visual C#.Net, .Net Editors & IDEs

Tags: ASP.NET C#, IE 7, ASP.NET User Control

when i try to load dynamically user control to my page there disappear , i need to keep the control and execute user control actionsStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
//default page
 
using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    private void LoadMain(string controle)
    {
        UserControl uc = (UserControl)LoadControl(controle);
        Session["control"] = uc;
        main.Controls.Clear();
        main.Controls.Add(uc);
    }
    protected void bt_c1_Click(object sender, EventArgs e)
    {
        LoadMain("c1.ascx");
    }
    protected void bt_c2_Click(object sender, EventArgs e)
    {
        LoadMain("c2.ascx");
    }
}
[+][-]03.02.2008 at 11:10AM PST, ID: 21027067

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Microsoft Visual C#.Net, .Net Editors & IDEs
Tags: ASP.NET C#, IE 7, ASP.NET User Control
Sign Up Now!
Solution Provided By: sanjeewaj
Participating Experts: 2
Solution Grade: B
 
 
[+][-]03.02.2008 at 01:48PM PST, ID: 21027756

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628