Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 23rd, 2006, 12:40 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default Runat server dilemma ?

I am putting this here because I believe the underlying problem is not understanding what tags to put "runat server" on to work with ASP and which not to. My problem is that I have a table as such:

***************
* A * *
* * *
***** C *
* * *
* B * *
* * *
* * *
***************

I want A to be fixed height, so that B will stretch when C expands in height. I have set up ID's for TD tags and have set CSS rules so that A's height is 100px and B= 100 %. Problem is that A expands to much more than 100px when I put a large picture in C.

My problem is that I am just going in and putting "runat server" properties hit and miss trying to get this to work. What do I have to do to the code below to get it so that A won't stretch above the 75 px?? In the code below it is the TD with ID "Sidebarabove" that I don't want changing.

Any help would be apprecited--this is driving me crazy.

Thanks in advance,
Rob


<%@ Master Language="VB" CodeFile="MasterPage.master.vb" 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 id="head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Knights Of Columbus Site</title>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>

<body id="body1" runat="server">
<form id="form1" runat="server">
<table id="MainTable" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
    <td id="Banner" colspan="2" style="height: 150px"><img src="Site_Images/rbanner.jpg" runat="server"/></td>
</tr>
<tr>
    <td id="Sidebar" valign="top">
    <div id="loginstate" align="center">
     <asp:LoginView ID="LoginView1" runat="server">
            <AnonymousTemplate >
                You are not logged in.
            </AnonymousTemplate>
         <LoggedInTemplate>
             Welcome<br />
             <asp:LoginName ID="LoginName1" runat="server" />
             <br />
             <asp:LoginStatus ID="LoginStatus1" runat="server" ForeColor="Black" />
         </LoggedInTemplate>
        </asp:LoginView>
    </div>
        <asp:TreeView CssClass="TreeControl" ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"
             ForeColor="Black" NodeIndent="10" ShowLines="True">
             <SelectedNodeStyle Font-Bold="True" />
         </asp:TreeView>
    
    </td>
    <td id= "MainContent" valign="top">
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </td>
</tr>
<tr>
    <td id="BannerBelow" colspan="2"><img src="Site_Images/banbelow.jpg" runat="server"/></td>
</tr>
</table>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>

CSS:
body {
    background-color: #000099;
}

.TreeControl
{
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:0.8em;
    font-weight:Normal;
    color:#000000;
}

#loginstate
{
    color:#0000ff;
    font-weight:bold;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:0.8em;
}

#login
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 1.0em;
    font-weight: Normal;
}

#MainTable {
    width: 800px;
}

#BannerBelow {
    height: 90px;
    width: 800px;
}

#Banner {
    height: 150px;
    width: 800px;
}
#Sidebar {
    height: 300px;
    width: 150px;
    background-image: url(Site_Images/sideback.jpg);
    background-repeat: repeat-y;
    border-left-width: medium;
    border-left-style: inset;
    border-left-color: #000000;
    top: 5px;
    position:inherit;
}
#MainContent {
    width: 650px;
    border-right-width: medium;
    border-right-style: inset;
    border-right-color: #000000;
    border-left-width: thin;
    border-left-style: inset;
    border-left-color: #000000;

}
#Charter
{
    width: 336px;
    padding: 5px;
    border: thin solid #000000;
    background-color: #333333;
}

#Link
{

    width:100%;
    height:100%;
    border: thin solid #000000;
}
 
Old November 24th, 2006, 04:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rob,

Take a look at the final HTML in the *browser*. You'll find that your IDs have been changed. In the final HTML, IDs need to be unique, so when you have, say, a <div> in a Content Page, .NET will rename it for you. So, your <td> with an ID of Sidebar may end up as something like _ctl001_Content_Sidebar

These longer IDs is what you should use in your CSS.


Hope this helps,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
<form runat="server"> gopi2008 ASP.NET 1.0 and 1.1 Basics 3 May 21st, 2006 11:07 PM
Runat = Server Lorzendo ASP.NET 1.0 and 1.1 Basics 1 November 12th, 2004 12:19 AM
HTML Control "select" runat="server" hamid HTML Code Clinic 3 October 13th, 2004 09:19 AM
OpenOffice List Dilemma AForgue XSLT 1 January 29th, 2004 11:42 AM
'exists' dilemma defiant SQL Server 2000 4 June 27th, 2003 07:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.