CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 7/6/2005 10:19:15 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 50 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
MRTotus
Asp.Net User
What is so special in Panel and PlaceHolder controls?7/6/2005 10:19:15 PM

0/0

Hello,

Can one write WebControl that has the same functionality as Panel control without inheriting from Panel or PlaceHolder? I'm talking about the flexibility of putting new controls between my <my:PanelLike runat=server>...</my:PanelLike> control tags. Why this is impossible when inheriting PanelLike control from WebControl? When I try to insert for example Button between tags the error comes out:

Error    1    Type 'Web.UI.WebControls.PanelLike' does not have a public property named 'Button'.    C:\...\Default.aspx    18   

[what I am trying to do is to figure out what is so special about Panel control that adding controls is possible]

Please help me understand this.

Thx



Problems are everywhere... It is time to solve them :]
Eilon
Asp.Net User
Re: What is so special in Panel and PlaceHolder controls?7/7/2005 4:28:42 AM

0/0

Hi,

You can definitely create controls just like Panel and PlaceHolder - there's no magic to them! :)

If you look closely at Panel, even though it derives from WebControl, it has two very important meta-data attributes on it:

[
ParseChildren(false),
PersistChildren(true),
]
public class Panel : WebControl {
 ...
}

If you add these two attributes to your control, it should work just fine. If you derive from just Control (instead of WebControl) then you don't need those two attributes since they are the default anyway.

The full name of "ParseChildren" is "Parse Children As Properties" meaning that all content within the control tag will be considered properties (for example, the <Items> tag in a DropDownList>). In your case you don't want that - you want content to be treated as simple child controls.
PersistChildren means that at design-time (for example, in Visual Studio) you want ASP.net to persist the child controls for you automatically.

Thanks,
Eilon


Blog: http://weblogs.asp.net/LeftSlipper/
MRTotus
Asp.Net User
Re: What is so special in Panel and PlaceHolder controls?7/7/2005 7:30:10 AM

0/0

WOW... now I am sure that I would never figure it out by myself :-). I was looking only on properties and functions of Panel control and there was nothing special in them :-)

Big thanks!
Problems are everywhere... It is time to solve them :]
MRTotus
Asp.Net User
Re: What is so special in Panel and PlaceHolder controls?7/7/2005 10:45:22 AM

0/0

I need one more tip.

I would like to create PlaceHolder like control which content (other controls added in "design time") would be wrapped in html tags and controls [added programaticly in my control's code]. For example: Table containing custom controls in one of its cells (Table generated by my control). And I need to know what is the best way to do this?

1. Should I override Controls property and make it point to e.g. PlaceHolder.Controls property which will be wrapped in my Table?
2. Or should I in PreRender event add Table to Controls property and remove all the controls contained in this Control property and add them to one of the TableCell.Controls?

Thank you in advance.

Problems are everywhere... It is time to solve them :]
Eilon
Asp.Net User
Re: What is so special in Panel and PlaceHolder controls?7/7/2005 4:34:16 PM

0/0

Actually what you could probably do is simply override your control's Render() method and do some additional work before and after calling base.Render():

protected override void Render(HtmlTextWriter writer) {
   writer.WriteStuff(); // Render whatever opening tags you want
   base.Render(writer);
   writer.WriteMoreStuff(); // Render whatever closing tags you want
}

You shouldn't have to mess with the Controls collection at all, and I wouldn't really bother messing with re-arranging child controls since it's easy to mess it up :)

Thanks,
Eilon
Blog: http://weblogs.asp.net/LeftSlipper/
MRTotus
Asp.Net User
Re: What is so special in Panel and PlaceHolder controls?7/7/2005 6:01:01 PM

0/0

And what about additional server controls [e.g. Image controls] that I want to be a part of this wrapping area...? I should manualy create them and in Render method call their Render methods explicitly?

I really apreciate your help,

Totus


Problems are everywhere... It is time to solve them :]
Eilon
Asp.Net User
Re: What is so special in Panel and PlaceHolder controls?7/7/2005 6:23:58 PM

0/0

I'd say that it's really up to you. You could definitely do it either way. If you want to learn a whole lot more about writing server controls, check out Nikhil Kothari's book:
http://www.amazon.com/exec/obidos/ASIN/0735615829/nikhilkothari-20/103-4524608-7611853

Nikhil is one of the developers here on the ASP.net team so he definitely knows his stuff :)

Thanks,
Eilon
Blog: http://weblogs.asp.net/LeftSlipper/
7 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Pro ASP.NET 2.0 in VB 2005: special edition. Authors: Laurence Moroney, Matthew MacDonald, Pages: 1360, Published: 2006
Programming Microsoft Web Forms Authors: Douglas J. Reilly, Pages: 303, Published: 2005
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
Programming WPF: Building Windows UI with Windows Presentation Foundation Authors: Chris Sells, Ian Griffiths, Pages: 863, Published: 2007
ASP.NET for Web Designers Authors: Peter Ladka, Pages: 648, Published: 2002
Professional Web Parts and Custom Controls with ASP.NET 2.0 Authors: Peter Vogel, Pages: 449, Published: 2005
ASP.NET Developer's JumpStart Authors: Paul D. Sheriff, Ken Getz, Pages: 648, Published: 2002

Web:
ASP.NET Panel, PlaceHolder Control The following code does nothing special but demonstrates how to use panels. ... The PlaceHolder Web server control does not have any visible output and is ...
Dynamically Add Controls to a Web Page | .NET Advisor May 31, 2008 ... The two best controls to use as containers are the PlaceHolder and the Panel. The difference between the two is that a Panel actually ...
Placeholders used by MODx Pages and Templates - MODx Wiki Navigate here via the admin control panel: Resources --> Manage META tags and Keywords These aren't typical placeholders, but they do allow you to use small ...
The zoom slider at the bottom of the panel controls the ... 2 In the Pages panel, double-click the right page of the B-Placeholder master page or. scroll horizontally so that the right page is centered in the ...
Ease Control Positioning Headaches These special panel controls can also be useful when designing your own Web ... The PlaceHolder control is often the best choice in such a situation because ...
Safari Books Online - 0789736055 - Special Edition Using Microsoft ... If you buy only one book on Expression Web, Special Edition Using Microsoft ... Panel, A container for multiple controls. PlaceHolder, A placeholder for ...
Bernese - Tutorial: Running The Process Control Script (PCS ... This final menu (panel 6.4.1-1.3 ) appears because the SPECIAL PARAMETERS ... In this panel the $O place holder will be substitued for R3 before the menu ...
Abstracts: Late-Breaking and Placeholder The Program Committee will consider for special oral presentation proffered ... After each presentation, a panel of experts in chemistry, basic research, ...
VSJ | .NET Zone | Master pages and visual inheritance in ASP.NET Add some controls to the derived page whose ID matches ... So, at the end of the day, a master page is treated as a special kind of ASP. ...
InDesignSecrets » Blog Archive » Less is more for the Control panel Have you ever taken things OFF the Control panel? If so, why? .... Use Your Own Placeholder Text in InDesign by David Blatner. The Gradient Panel Is Such a ...

Videos:
Structuring Personal Information When Everything Can Be Saved and Searched... Google TechTalks May 17, 2006 William Jones William Jones is an Research Associate Professor in The Information School at the University of Washingt...




Search This Site:










dynamically created textboxes don't have the name/id i give them ?!

asp.net 2.0 webrequest method in a shared hosting environment

web hosting

ie webcontrols source code

creating custom events for control.

calendar custom class

composite calendar control

calendar control

how to use both component and code behind in an aspx page?

inheriting base controls and interfaces

custom control databinding?

book opinions

dynamic properties

creating custom control

server controls not responding in the ide

i need new web hosting :(

slightly modifying template control look in design

web hosts reseller programmes

two web applications/web configs ?

keep state of the user control

mass event processing suggestion

user control postback problem

compiling ie webcontrols

execute .bat file in web form using asp.net

object reference not set to an instance of an object

sql server 2005 common language run-time (clr) integration

accessing appsettings and connectionstrings from designtime

inherit control and design it

derived custom controls && composite controls

read in id's of all instances of a custom control within cached user control

  Privacy | Contact Us
All Times Are GMT