473,802 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create UserControl as webpart at runtime.

I'm adding UserControls as WebPart at runtime to a WebPartZone. This is
working fine but when I add two or more UserControl instances, the
UserControls are overlapping each other i.e. When I add first UserControl it
gets added successfully but when I add another UserControl to the same zone,
this new UserControl overlapps the first UserControl and it gives a confusing
look to the user. Also, the Title area of these webparts shows at different
areas but actual control overlaps each other.

Here is the code I'm using to create and add UserControls as WebPart:
protected void CreateWebPart(s tring ucName)
{
int index = wpzCycloneOpera tions.WebParts. Count - 1;

Control uc = this.LoadContro l(ucName);
uc.ID = ucName + index.ToString( );


GenericWebPart _wp = WebPartManager1 .CreateWebPart( uc);
_wp.Title =

" ";
_wp = (

GenericWebPart) WebPartManager1 .AddWebPart(_wp , wpzCycloneOpera tions, index +
2);
_wp.ChromeType =

PartChromeType. None;
_wp.Height =

Unit.Pixel(1);
}

Please help me to solve this issue.

May 2 '07 #1
0 1392

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1210
by: J. Jespersen | last post by:
Hi people, I fiddling with webparts, and have created my own custom webpart from scratch. The webpart itself is contained in a myPart.dll I have two different sites. SiteA and SiteB. Both are webparts-based. I have added the webpart to my toolbox, and added it to a declarativeCatalogPart, and finally added the webpart to a webPartZone. No problemo. I have allowed the webpart for export, and have exported it to a
1
2740
by: Luc | last post by:
Hi, I have a TabControl and, at runtime, I need to add some tabpages. The problem is that each tabpage is similar to the others and contains several controls. If I do TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is added. How can I add in few statements a new tabpage as well as its controls (textboxes, labels, etc.)? The first tabpage (that I create at design time) is the "template" to be used for the other tabpages. Is...
3
4745
by: DexHex | last post by:
Hi, I am stumpt. Is there anyway to set the background image on a webpart title?
1
1110
by: milmus tender | last post by:
Hi, is it possible to generate dynamicly new WebPart Pages? Each user of my application should have the possibility to save many different Views (WebPart Pages). Thanks, Milmus
2
1499
by: Mike Hildner | last post by:
Hello, I'm trying out web parts for the first time. I put a manager and a zone on my page, then put a control in the zone. Documentation states that the minimize button is there by default. It is at design time, but does not show up at runtime. What am I missing? Thanks,
5
1777
by: Paal Berggreen | last post by:
I am involved with development of a Portal solution using ASP.NET 2.0 and WebParts. The WebParts framework use the default personalization providers, and the personalization data thus ends up in the aspnetdb database (which we have placed on a proper SQL Server, not SQL Server Express). Everything works like a charm, with the following exception: New users in the system have to press links or buttons twice upon their first logon to...
2
5072
by: Steve | last post by:
This is a weird one. I have a series of "SmartParts" which are CAB (Composite Application Block) Views which are finally just UserControls (99% of the time) Anyway, I layout my UserControl in the VS2005 designer, but at runtime, the controls are in different locations and different sizes. I have been able to restore their sizes by putting a hack together that will set their sizes to the correct values in the UserControl's Resize...
3
1732
by: Jav | last post by:
I create a UserControl (.ascx), and then change it in code to: Inherits System.Web.UI.WebControls.WebParts.WebPart expecting that it will now be treated as a WebPart. But this immediately generates 2 errors. How does one go about creating a WebPart by inheriting as above? (I know that I can drag a UserControl into a WebPartZone and it will be wrapped in a GenericWebPart.) Thanks Jav
4
1551
by: Arnab das | last post by:
I am working in asp.net webpart.I want to show the delete warning message in a modal popup. How can I achieve this?
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10305
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.