473,729 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Controls, Web Parts and Image Controls

I've been tasked with the not-enviable job of creating an application
with multiple, semi-customizable templates. My basic concept, thus far,
has been a combination of Master Pages (for layout) and WebPartZones.

Each master page implements an interface (call it IMasterPage), which
provides public properties for the WebPartManager and 3 WebPartZones.
(Rule #1 was static number of zones.)

However, each template can have these zones be different sizes. And I
want my content to be somewhat fluid in this regard. Not really a
problem most of the time; just use percentages. Except on pictures.

Because of the way the app is designed, the images (upon upload into
the system) resize themselves four ways (640px wide, 480px wide, 320px
wide and 160px wide, height proportional). I want to ascertain the
width of the control's containing zone and use the appropriate image,
changing not only the ImageUrl property, but also the Height and Width
properties.

BTW, this is all in an .ascx-based UserControl, which is then being
dynamically loaded into the appropriate WebPartZone at run-time.

I'd think the answer would be simple ... But it's not. The UserControl,
naturally, has no idea what it's held in, so I've ensured that all my
webpart-to-be controls implement an interface (call it
IWebPartUserCon trol) which provides a Resize method (taking a width).

At the point when the page determines which Master Page template to use
(PreInit event), it populates the WebPartZones dynamically. At the
point of loading the control (LoadControl) but before adding it into
the Zone (AddPart), I use this Resize method with the Zone's width.
This Resize method determines the appropriate image and size, and
changes the Image control's properties to suit.

But it never gets reflected in the output HTML. The image tag is
emitted, but it is empty (because ImageUrl is empty in the ascx), and
none of the resize work seems to affect anything. (Using Trace, I was
able to ascertain that it WAS, at least, being performed.)

I've tried adding the web parts and resizing in Page_Load, Page_Init
and Page_PreInit. In Load and Init, the web parts all load but the
resizing has no effect. In PreInit, the web parts don't even bloody
load.

Any help here? Am I stuck doing custom WebPart implementations and
manually coding all the work?

Thanks!

Sep 22 '06 #1
1 2185
It would appear that I'm stuck manually coding the whole kit and
kaboodle. Which is fine, I guess ... But it appears that once again,
ASP.NET 2.0 makes the easy stuff absurdly easy, and anything even
_slightly_ more complicated absurdly difficult.

John

ru*****@gmail.c om wrote:
I've been tasked with the not-enviable job of creating an application
with multiple, semi-customizable templates. My basic concept, thus far,
has been a combination of Master Pages (for layout) and WebPartZones.

Each master page implements an interface (call it IMasterPage), which
provides public properties for the WebPartManager and 3 WebPartZones.
(Rule #1 was static number of zones.)

However, each template can have these zones be different sizes. And I
want my content to be somewhat fluid in this regard. Not really a
problem most of the time; just use percentages. Except on pictures.

Because of the way the app is designed, the images (upon upload into
the system) resize themselves four ways (640px wide, 480px wide, 320px
wide and 160px wide, height proportional). I want to ascertain the
width of the control's containing zone and use the appropriate image,
changing not only the ImageUrl property, but also the Height and Width
properties.

BTW, this is all in an .ascx-based UserControl, which is then being
dynamically loaded into the appropriate WebPartZone at run-time.

I'd think the answer would be simple ... But it's not. The UserControl,
naturally, has no idea what it's held in, so I've ensured that all my
webpart-to-be controls implement an interface (call it
IWebPartUserCon trol) which provides a Resize method (taking a width).

At the point when the page determines which Master Page template to use
(PreInit event), it populates the WebPartZones dynamically. At the
point of loading the control (LoadControl) but before adding it into
the Zone (AddPart), I use this Resize method with the Zone's width.
This Resize method determines the appropriate image and size, and
changes the Image control's properties to suit.

But it never gets reflected in the output HTML. The image tag is
emitted, but it is empty (because ImageUrl is empty in the ascx), and
none of the resize work seems to affect anything. (Using Trace, I was
able to ascertain that it WAS, at least, being performed.)

I've tried adding the web parts and resizing in Page_Load, Page_Init
and Page_PreInit. In Load and Init, the web parts all load but the
resizing has no effect. In PreInit, the web parts don't even bloody
load.

Any help here? Am I stuck doing custom WebPart implementations and
manually coding all the work?

Thanks!
Sep 25 '06 #2

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

Similar topics

8
2591
by: Eric Veltman | last post by:
Hello everyone, I've posted this question before, but got no answer, so I'll try to reformulate the question, maybe it helps :-) By the way, this is not intended as the start of an ASP.NET flamewar. Before looking at PHP, I've used ASP.NET extensively for about a year and some things that I like a lot about it : - Design and code can be easily kept separate.
2
6609
by: Technical Group | last post by:
Friends, Can anybody help me out by sending a piece of C# code showing how to add an active directory user to a particular user group? If the group does not exist, then create it. Thanks in advance -Hari
4
1939
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
2
1979
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
0
1933
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
3
2236
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for some reason I keep getting the error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
9
2892
by: TCORDON | last post by:
I have a user control that contains 2 image buttons, when you click one of them, both must change the image source, the thing is that the first time you click any one of them the page appears to do a postbak, but the image source or the image displayed does not change until I click one of the images a second time, why dows it take 2 clicks for the user to "refresh"? TIA!
7
3005
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm attempting to bind a user control I've written, "ImageBox", to a repeater. The user control takes a custom property, "ContentID", that will execute a database lookup and load an image.
3
1687
by: AleXmanFree | last post by:
Hi , I have got problem with passing my inline based value to y user control (or custom control, no matter which one I use, I have tried both to make sure it doesnt matter) . So say I have property called ImagePath and i want to pass my value through asp.net specific inline cunstruction: <uc:MyControl runat=server id="someId" ImagePath="<%= Request.ApplicationPath %>/App_Themes/<%= Page.Theme %>/Images/ ball_.png" />, problem that in...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
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...
0
9142
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
4525
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...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.