user1007103
user1007103

Reputation: 425

display:none; on a Placeholder?

I have a placholder that I dont just want to use Visible="false" on, becouse it reserv some space on the page. I dont want the space reservation. How can I do that? Maybe use somethingels?

  <asp:DataList ID="ImageList" runat="server" RepeatDirection="Horizontal" EditItemStyle-VerticalAlign="Top"
            RepeatColumns="4">           
            <ItemTemplate>
            <asp:PlaceHolder ID="phImage" runat="server" Visible="false">
                <div class="prodImagesBorder"> "SOME STUFF with auto length and width"
                    <div class="prodImages"> "SOME STUFF"
                        <div class="thumbnail"> "SOME STUFF"

                        </div>
                    </div>
                </div>
                </asp:PlaceHolder>
            </ItemTemplate>
        </asp:DataList>

Codebehind:

    if(ImageTabel.Rows[i]["ImgUrl"].ToString() != lblOldImgUrl.Text)
                        {
                            PlaceHolder phImage = (PlaceHolder)ImageList.Items[i].FindControl("phImage");
                            phImage.Visible=true;
                        }

Upvotes: 0

Views: 1689

Answers (2)

to StackOverflow
to StackOverflow

Reputation: 124804

A PlaceHolder does not render a tag - it's just a container for other server controls. So there's no tag on which you can set display:none.

Upvotes: 1

Rob Rodi
Rob Rodi

Reputation: 3494

elements with the CSS style display:None will take up no space. if you apply it to div.prodImagesBorder, it should completely hide that element.

Upvotes: 0

Related Questions