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

How do you resize a ContentPlaceHolder for a MasterPage

I am trying to resize a Content place holder in a master page.  I can get the handles to change the size but the box is frozen in size.  What am I doing wrong?

Thanks
Kenny
0
kwh3856
Asked:
kwh3856
  • 7
  • 5
1 Solution
 
Bob LearnedCommented:
There is a <div> on the placeholder that you need to select and size.

Bob
0
 
kwh3856Author Commented:
Bob,
I looked for the <div> around the box and did not see one.  I did see <div> in the source code section but I am not sure what to do with it.  When you say select and size, can I drag and resize the box or is it done programitically?

Thanks
Kenny
0
 
Bob LearnedCommented:
Kenny,

I had to revisit this process, since I already had a Master page with all this set up, and I haven't spent much time with 2.0.  I started over, and came up with a Master page and a web page to see what steps are required.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Bob LearnedCommented:
Here the master page:

<%@ Master Language="C#" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="position:absolute; width: 336px; height: 488px; background-color:wheat; left: 304px; top: 48px;"><asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
    </div>
    <div style="position:absolute; width: 260px; height: 488px; background-color:lightblue; left: 32px; top: 48px;">
                        <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
                        </asp:ContentPlaceHolder>
                        </div>
    </form>
</body>
</html>
0
 
Bob LearnedCommented:
Here is the web page:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="Button1" runat="server" Style="z-index: 100; left: 192px; position: absolute;
        top: 252px" Text="Button" />
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder2">
    <asp:CheckBox ID="CheckBox1" runat="server" Style="z-index: 100; left: 52px; position: absolute;
        top: 256px" />
</asp:Content>

Bob
0
 
Bob LearnedCommented:
It is kind of tricky resizing the <div>.  You need to set the positioning to absolute:

<div style="position:absolute; ...

When selecting the <div> to resize, be careful not to select the ContentPlaceHolder.  With absolute positioning, you can locate the place holder anywhere on the page, and have multiple ContentPlaceHolder controls on the same MasterPage.

Bob
0
 
kwh3856Author Commented:
Bob,
I will give it a try as soon as possible.  I will let you know if I am successful.  As you can probably tell, I am just beginning to learn C#.  

Thanks
Kenny
0
 
Bob LearnedCommented:
Kenny,

I am very sympathetic to those who are just starting to learn C# and ASP.NET at the same time.  It is a very large, deep ocean of information to be learned.  

Bob
0
 
kwh3856Author Commented:
Bob,
I am currently usine C# by Wrox and have a platinum membership to www.learnvisualstudio.com.  I am about to embark upon a very large C#/ASP.net application and will be learning by fire:)

Do you have any suggestions for good web sites or books to read.  For example, I read the Wrox book on the Content Place Holder and there was not much information.  Where do you learn about the information you gave me.  Is that just from experience or did you find it somewhere?

Thanks
Kenny
0
 
Bob LearnedCommented:
Kenny,

There isn't any one good place for information for me.  So, you have to take from each of the resources that could help you for whatever you are requiring (such as ContentPlaceHolders).

Here are some good resources for me:

ASP.NET Quickstart Tutorial
http://www.asp.net/quickstart/aspnet/

ASP Alliance
http://aspalliance.com/

C# Corner
http://www.c-sharpcorner.com/AspNet2.0.asp

DeveloperFusion:
http://quickstart.developerfusion.co.uk/quickstart/aspnet/

Bob
0
 
kwh3856Author Commented:
Many thanks.  I am doing my "real work" right now but will be doing the programming tonight.  I will let you know how I fare.  Again thanks for the info.

Thanks
Kenny
0
 
kwh3856Author Commented:
Bob,
Many thanks!!!!!!

You are right.  It is tricky working with but I think I just need to go and study about the <div style> command.  Agian, thank you very much.

Thanks
Kenny
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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