• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1606
  • Last Modified:

Panels versus Placeholders.......

Dear All,

As far as I can understand it is better to use the Panel to contain/ place other controls since you can control the position via the IDE. The placeholder seems stuck at the top left hand corner of the page, so I am unsure of the benefits of the placeholder.

Please enlighten me....

Thanks,

Sam
0
SamJolly
Asked:
SamJolly
  • 5
  • 2
  • 2
  • +2
4 Solutions
 
riyasjefCommented:
Hi
Placeholder control is only for holding controls ...
Server sends nothing if there is no child control in it...
But in the case of "panel" server generates <diV> tag or <layer> depends on the browser.
U can control the style attributes of panel control easily...
(Eithre using IDE or dynamically)
So if you want to align the controls as a whole ..better put it in a panel control..

RJ

0
 
aspmaestroCommented:
0
 
SamJollyAuthor Commented:
Why would you want a control container without positioning?? ie Placeholder.

Thanks,

Sam
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
riyasjefCommented:
It can act as a parent control ... holding other controls..
U can programmatically add controls to a place holder...
0
 
aspmaestroCommented:
due to adaptive rendering, panel may tend to render as <table> instead of <div> in browsers other than IE...whereas placeholder doesnt produce markup anywhere. you can position the controls using combination of placeholder and table server controls..
0
 
SamJollyAuthor Commented:
So are you saying that placeholders only act as logical containers for programming against, and positioning can only be applied against the child controls of the placeholder.

It is confusing since the name 'placeholder' implies to me reserving s place on the page for all the child control, therefore this would implicitly include positioning, but obviously not....

Thanks,

Sam
0
 
raterusCommented:
let's say I had an html table, and only certain users should see certain rows, placeholders work well here.

<table>
  <tr>
    <td>Everyone Sees This</td>
  </tr>
  <asp:placeholder ... >
  <tr>
    <td>Secure Row 1</td>
  </tr>
  <tr>
    <td>Secure Row 2</td>
  </tr>
  </asp:placeholder>
</table>

certainly, you cannot have anything really render between <tr> tags, but since you want to configure the visibility of multiple rows, the best bet here is the placeholder.  From codebehind, you can set the visibility on/off.
0
 
QingtongCommented:

ASP.NET will never change any content you put in placeholder, so most of time, when you need to dynamically add some control of page, such as <Link> <Head> and <Meta> etc. you need use placeholder instead of panel, which will add <DIV> and <LAYER> for the controls.

For general asp.net control, I think both of them are same.

Qingtong
0
 
SamJollyAuthor Commented:
Raterus et al, I can understand your example, in essence there is only the visible property to control this control. So basically you can only show/not show the contained code. Am I right...

Thanks,

Sam
0
 
raterusCommented:
Correct, without using a placeholder, you'd have to make each <tr> runat=server, and set visible=false; if you had a ton of rows it would be nasty!
0
 
SamJollyAuthor Commented:
Thanks all,

Sam
0
 
SamJollyAuthor Commented:
A thought occurred to me. I have just been playing around with the panel which contains the calendar control. I am using the panel, in this case, to make the calendar visible or invisible. Really this ought to be client script driven which is altering the css for the panel <DIV>. What is the recommended way of doing this.... is it manul coding again or is there another route in VS.IDE

Thanks,

Sam
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 5
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now