Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem to create webPart dynamically!

Problem to create webPart dynamically!

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hdv212
    wrote on last edited by
    #1

    Hi i have a simple web app which display some webparts from external assemblies. user can select available webParts and add to selected zone via this code :

    Type type = _dicWebparts[this.ddlWebParts.SelectedValue];
    WebPart webPart = (WebPart)Activator.CreateInstance(type);
    this.WebPartManager1.AddWebPart(webPart, this.WebPartManager1.Zones[this.ddlZones.SelectedValue], 0); // cause error!!

    but as u see in the last line (where cause the problem), i'm facing this error :

    System.InvalidOperationException: Cannot add a control of Type MyWebPart1.MyWebPart1. The Type must be loadable by BuildManager.GetType(string typeName).

    How to solve this problem ? thanks in advance

    H 1 Reply Last reply
    0
    • H hdv212

      Hi i have a simple web app which display some webparts from external assemblies. user can select available webParts and add to selected zone via this code :

      Type type = _dicWebparts[this.ddlWebParts.SelectedValue];
      WebPart webPart = (WebPart)Activator.CreateInstance(type);
      this.WebPartManager1.AddWebPart(webPart, this.WebPartManager1.Zones[this.ddlZones.SelectedValue], 0); // cause error!!

      but as u see in the last line (where cause the problem), i'm facing this error :

      System.InvalidOperationException: Cannot add a control of Type MyWebPart1.MyWebPart1. The Type must be loadable by BuildManager.GetType(string typeName).

      How to solve this problem ? thanks in advance

      H Offline
      H Offline
      hdv212
      wrote on last edited by
      #2

      Any help ?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups