Web Part Minimize

Discussion in 'ASP .Net' started by Santosh, Jun 1, 2006.

  1. Santosh

    Santosh Guest

    When I dynamically add Web parts to my code On Minimize event web part
    get deleted.
    My WebPartZone, WebPartManager is defined in MasterPage
    I want to programatically add control to my Web Part.

    Code is as follows.

    Kindly Help

    protected void Page_Load(object sender, EventArgs e)
    {
    WebPartZone wz =
    (WebPartZone)Master.FindControl("WebPartZone1");
    // WebPartZone wz2 =
    (WebPartZone)Master.FindControl("WebPartZone2");
    // string s = wz.WebParts.Count.ToString();
    WebPartManager wm =
    (WebPartManager)Master.FindControl("WebPartManager1");
    Control con = LoadControl("WebUserControl.ascx");
    con.ID = "userControl";
    GenericWebPart wp = wm.CreateWebPart(con);
    wp.ID = "w1";
    wp.AllowEdit = true;
    if (! IsPostBack )
    wm.AddWebPart(wp, wz, 0);

    wm.DisplayMode = WebPartManager.DesignDisplayMode;
    }
     
    Santosh, Jun 1, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. a

    Minimize window when Show

    a, Oct 10, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    536
  2. Latha Rajeev

    "Minimize event"

    Latha Rajeev, Jul 18, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    410
    Latha Rajeev
    Jul 18, 2003
  3. Jupiter49

    How to minimize /bin folder redundancy

    Jupiter49, Aug 20, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    317
    Jupiter49
    Aug 20, 2003
  4. Paul LeBlanc

    Re: How to minimize /bin folder redundancy

    Paul LeBlanc, Aug 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    316
    George Ter-Saakov
    Aug 21, 2003
  5. Erik  Bethke
    Replies:
    1
    Views:
    1,953
    Erik Bethke
    Feb 8, 2005
Loading...

Share This Page