how to leftalign buttons in div? - asp.net

i am trying to align a few buttons in my asppanel. So but1 and but3 need to be left aligned?
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.flo
{
float: left;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel CssClass="fl0" ID="pnl1" runat="server" Style="background-color: #DDDDDD;
border: solid 1px black; vertical-align: middle; text-align: center;" Width="120px"
Height="42px">
<div style="margin-top: 0px; margin-left: -28px; float:left">
<asp:Button ID="Button1" runat="server" Text="but1" />
<asp:Button ID="Button2" runat="server" Text="but2" Visible="true" />
<asp:Button ID="Button3" runat="server" Text="but3" Visible="true" />
</div>
</asp:Panel>
</div>
</form>
</body>
</html>

try this:
div style="text-align:left; padding:10px 0 0 0;">
<div style="padding:3px 0 0 0; height: 36px;">
<asp:Button ID="Button1" runat="server" Text="but1" />
<asp:Button ID="Button2" runat="server" Text="but2" Visible="true" />
<asp:Button ID="Button3" runat="server" Text="but3" Visible="true" />
</div>
</div>

Related

ASP.NET Web Form - TreeView Nodes are dislocated

The last node in the TreeView (ASP) control is being displayed at a different location, though the hierarchical logic remains and I can collapse the node.
The TreeView is nested within a Panel, which is inside a <div>. I have made enough place for it to expand, and even maximized the TreeView size, but same issue. Now after some days of searching for help here, and because I'm new in Web designing. Also, there is no Scrollbar Property for the TreeView.
I'm coding using .NET 3.5
CODE:
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="Genographic._Default" %>
<!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></title>
<style type="text/css">
#form1
{
height: 100%;
}
.bigDiv
{
width: 100%;
height: 155px;
background-color: red;
}
.imageDiv
{
width: 50%;
height: 600px;
background-color: white;
}
.labelDiv
{
width: 39%;
height: 600px;
background-color: control;
}
div > div
{
float: left;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="bigDiv">
<asp:Panel ID="Panel_Menu" runat="server" BackColor="#336699" Width="100%" Height="155px">
<center>
<asp:Label ID="Label1" runat="server" Text="..."
Font-Size="X-Large" ForeColor="White"></asp:Label>
</center>
<br>
</asp:Panel>
<div class="imageDiv">
<asp:Image ID="Image_Map" runat="server" Height="600px" Width="600px" ForeColor="#CCCCFF" />
</div>
<div class="labelDiv">
<asp:Panel ID="Panel1" runat="server" Height="582px" Width="640px" Style="display: inline-block;">
<br>
<asp:Label ID="Label2" runat="server" Text="Level: "></asp:Label>
<br>
<asp:TreeView ID="TreeView_Level" runat="server" PopulateNodesFromClient="False"
ShowLines="True" Height="300px" Width="251px">
<SelectedNodeStyle ForeColor="#FF6600" />
</asp:TreeView>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<asp:Label ID="Label3" runat="server" Text=""></asp:Label>
<br>
<asp:TreeView ID="TreeView_2" runat="server" ShowLines="True">
<SelectedNodeStyle ForeColor="#FF6600" />
</asp:TreeView>
</asp:Panel>
</div>
</div>
</form>
</body>
</html>
I got it working using absolute positioning.
<!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></title>
<style type="text/css">
#form1
{
height: 100%;
}
.bigDiv
{
width: 100%;
height: 155px;
background-color: red;
}
.imageDiv
{
position: absolute;
top: 180px;
left: 510px;
width: 600px;
height: 100%;
background-color: green;
}
.labelDiv
{
position:absolute;
top: 180px;
left: 5px;
width: 500px;
height: 100%;
background-color: yellow;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="bigDiv" style="background-color: #3366CC">
<center>
<asp:Label ID="Label1" runat="server" Text="..."
Font-Size="X-Large" ForeColor="White"></asp:Label>
</center>
<br>
<div class="imageDiv">
<asp:Image ID="Image_Map" runat="server" ForeColor="#CCCCFF" />
</div>
<div class="labelDiv">
<asp:Label ID="Label2" runat="server" Text="Level:"></asp:Label>
<br>
<asp:TreeView ID="TreeView_Level" runat="server" PopulateNodesFromClient="False"
ShowLines="True" Width="416px">
<SelectedNodeStyle ForeColor="#FF6600" />
</asp:TreeView>
<br>
<br>
<asp:Label ID="Label3" runat="server" Text="...:"></asp:Label>
<br>
<asp:TreeView ID="TreeView_H" runat="server" ShowLines="True">
<SelectedNodeStyle ForeColor="#FF6600" />
</asp:TreeView>
</div>
</div>
</form>
</body>
</html>

How to align buttons properly in css/asp.net?

I'm trying to align 2 sets of buttons to the panel in the div above. The buttons called but1, but2 for the left panel. The others are but1, but2, but3 right panel. At the moment the buttons are in a straight line under the 2 panels. So I would like the 2 left buttons right under the left panel aligned left. The 2 right buttons right under the right panel align left?
HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
div.input
{
clear: left;
margin: 0 0 0.2em;
padding: 6pt 1em;
}
.flclass
{
float: left;
}
.imageDetails
{
color: Gray;
line-height: 1.2;
margin: 34px 0 0 10px;
}
input.special
{
background: none repeat scroll 0 0 #913297;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="input">
<label>
panel 1</label>
<asp:Panel CssClass="flclass" ID="pnlcustomerImage" runat="server" Style="background-color: #DDDDDD;
border: solid 1px black; vertical-align: middle; text-align: center; padding: 0"
Width="200px" Height="70px">
<asp:Literal ID="lt1" runat="server" Text="Panel left" />
<asp:HyperLink ID="hl1" runat="server" Target="_blank">
<asp:Image ID="im1" runat="server" Visible="false" Width="200px" Height="70px" AlternateText="Contact Admin to change your image" /></asp:HyperLink>
</asp:Panel>
<div class="flclass">
<p class="imageDetails">
<asp:Literal ID="lt4" Text="what to write here?" runat="server" />
</p>
</div>
<label>
small image</label>
<asp:Panel CssClass="flclass" ID="pnlAgentSmallLogo" runat="server" Style="background-color: #DDDDDD;
border: solid 1px black; vertical-align: middle; text-align: center;" Width="120px"
Height="42px">
<asp:Literal ID="lt2" runat="server" Text="Panel right" />
<asp:HyperLink ID="hl2" runat="server" Target="_blank">
<asp:Image ID="im2" runat="server" Visible="false" Width="120px" Height="42px" AlternateText="Contact Admin to change your image" /></asp:HyperLink>
</asp:Panel>
<p class="imageDetails" style="margin-top: 5px">
<asp:Literal ID="lt3" Text="what to write here?" runat="server" /></p>
<div class="input" style="margin: top">
<label>
</label>
<asp:Button ID="btn1" runat="server" Text="but1 left" CssClass="special" Style="margin-top: 54px;
margin-left: 10px" />
<asp:Button ID="btn2" runat="server" Text="but2 left" CssClass="special" Style="margin-top: 54px;
margin-left: 10px" Visible="true" />
<asp:Button ID="btn3" runat="server" Text="but1 right" CssClass="special" Style="margin-top: 26px;
margin-left: 10px" />
<asp:Button ID="btn4" runat="server" Text="but2 right" CssClass="special" Style="margin-top: 26px;
margin-left: 10px" Visible="true" />
<asp:Button ID="btn15" runat="server" Text="but3 right" CssClass="special"
Style="margin-top: 26px; margin-left: 10px" Visible="true" />
</div>
</div>
</form>
</body>
</html>
Change ur code
<asp:Button ID="btn3" runat="server" Text="but1 right" CssClass="special" Style="margin-top: 26px; margin-left: 150px" />
set margin-left: 150px in btn3
For future viewers, I found that this works better:
<asp:Button ID="btn3" runat="server" Text="but1 right"
CssClass="special" Style="margin-left:auto; display:block;" />
That way, if you change the width of your button, you don't have to do math to figure out the margin size.

How to shrink size of DataGrid?

I am developing a VB.NET app which returns data to a DataGrid. Everything works correctly now except for one thing. I want all of the blank white space below my datagrid to not appear, so that users don't have to worry about scrolling down the page.
Currently, it shows the DataGrid correctly, with a scrollbar and this grid takes up about half the height of my monitor. But then there is alot of empty white space below this grid. How can I remove that?
Here is the end of my ASPX file:
<head>
<title></title>
<style type="text/css">
.DataGridFixedHeader {background-color: #336699; color:White; font-weight: "bold"; position:relative; top:expression(this.offsetParent.scrollTop);}
#txtFind{ width:150; padding:5px; outline:none; height:20px; }
.focusField{ border:solid 2px #73A6FF; background:#EFF5FF; color:#000; }
.idleField{ background:#EEE; color: #6F6F6F; border: solid 2px #DFDFDF; }
</style>
</head>
<body>
<form runat="Server" defaultbutton= "btnFind" method="post" id="Form1">
<div style="font-size:18pt; font-family:verdana; font-weight:bold; color:#336699">
Parts Watch List
</div>
<hr style="font-weight: bold; font-size: 20pt; color:#000080;" />
<div style="height: 380px; text-align: center; position: static;">
<input id="part_transfer" type="hidden" runat="server"/>
<input id="part_desc_transfer" type="hidden" runat="server"/>
<asp:Panel id="Panel1" runat="server" HorizontalAlign = "Center">
<span style="font-weight: bold; text-align: left; font-size: 15pt;">
Calculation:</span><br />
Reliability Rate = 1 - ( number of failed parts in the last 6 months / Part Multiplier * Average instrument Census in the last 6 months),<br />
Where
<br />
Number of failed parts - Summation of failures of a part for a 6 month period<br />
Part Multiplier - Number that represents how many times a part is used on the intrument<br />
Average instrument census - Average of the instrument census for the same
6 month timeframe as failed parts<br />
<br />
Please choose one of the parts below to view the control charts.</p>
</asp:Panel>
<asp:Panel id="Panel2" runat="server" Visible="false">
<chart:WebChartViewer id="WebChartViewer1" runat="server" HorizontalAlign="Center" />
</asp:Panel>
</div>
<hr style="width: 90%; position: static;" />
<div style="text-align: center; position: static; ">
<asp:Label id="CensusLastUpdate" runat="server"/><br />
<asp:Button id="btnExport" runat="server" Text="Export to Excel"></asp:Button>
<asp:CheckBox id="check1" Text="Display Only Parts Below Threshold" TextAlign="Right" AutoPostBack="True" OnCheckedChanged="ReRun_Main" runat="server" />
<br />
<asp:TextBox ID="txtFind" Text="Enter Part Number" runat="server" />
<asp:Button ID="btnFind" Text="Search" runat="server" OnClick="SearchTable" />
</div>
<% Dim scrollPosURL As String = "../includes/ScrollPos.htc"%>
<input id="saveScrollPos" type="hidden" runat="server" name="saveScrollPos"/>
<table border="0" cellspacing="0" align="center" style="" >
<tr>
<td>
<div style="OVERFLOW: auto; HEIGHT: 400px; vertical-align: top; ">
<ASP:DATAGRID ID="dgTable" HorizontalAlign="Center" runat="server" AutoGenerateColumns="False" ShowHeader="True" OnItemDataBound="DataGrid1_ItemDataBound">
<AlternatingItemStyle BackColor = "#eeeeee" />
<HEADERSTYLE CssClass="ms-formlabel DataGridFixedHeader" />
<COLUMNS>
<ASP:BOUNDCOLUMN HEADERTEXT="PN" DATAFIELD="PART_NUM" READONLY="true" ItemStyle-Width="130px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="PART_DESC" DATAFIELD="PART_DESC" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="numFailed" DATAFIELD="NUM_FAILED" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="AvgCensus" DATAFIELD="AVG_CENSUS" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="PartMultiplier" DATAFIELD="PartMultiplier" READONLY="true" ItemStyle-Width="150px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="ReliabilityRate" DATAFIELD="RELIABILITY_RATE" READONLY="true" ItemStyle-Width="105px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="PRIORITY" DATAFIELD="PRIORITY" READONLY="true" Visible="False" ItemStyle-Width="0px" ItemStyle-Font-Size="8"/>
<ASP:BOUNDCOLUMN HEADERTEXT="Criticality" DATAFIELD="Criticality" READONLY="true" ItemStyle-Width="105px" ItemStyle-Font-Size="8"/>
</COLUMNS>
</ASP:DATAGRID>
</div>
</td>
</tr>
</table>
</form>
<!-- Javascript at the bottom for fast page loading -->
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js" type="text/javascript"></script>
<script type="text/javascript"> window.jQuery || document.write('<script src="js/libs/jquery-1.6.1.js">\x3C/script>')</script>
<!-- Scripts concatenated -->
<script src="js/plugins.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>
<!-- End scripts -->
</body>
</html>
Reduce the style height (currently set to 400px) on the DIV that it lives in.

Help with aligning the controls

I have a dropdownlist (asp.net) and when user change the selection from the dropdownlist it display respected div.
i need help in aligning the controls. and want to look like this:
DropdownListControl -- > selected_div -- > button
below is my soucr code....
<div style="width: 880px; padding-top: 2px; border-bottom: none;
height: 28px;">
<asp:Label ID="lblFilterResultsBy" runat="server" Text="Filter Results by:"></asp:Label>
<asp:DropDownList ID="ddlFilter" runat="server" Width="221px">
<asp:ListItem Text="Select..." Value=""></asp:ListItem>
<asp:ListItem Text="Date" Value="DATE"></asp:ListItem>
<asp:ListItem Text="Subject" Value="SUBJECT"></asp:ListItem>
<asp:ListItem Text="Status" Value="STATUS"></asp:ListItem>
</asp:DropDownList>
<div id="divDateRangeSearch">
<div style="float: left">
<asp:Label ID="lblDateRange" runat="server" Text="Date Range"></asp:Label>
<br />
<uc1:DatePicker ID="FromDate" runat="server" />
<uc1:DatePicker ID="ToDate" runat="server" />
</div>
</div>
<div id="divSearchSubject" >
<div style="float: left">
<asp:Label ID="lblSubject" runat="server" Text="Subject"></asp:Label><br />
<asp:TextBox ID="txtSubject" runat="server" Width="225px"></asp:TextBox>
</div>
</div>
<div id="divStatusSearch">
<div style="float: left">
<asp:Label ID="lblStatus" runat="server" Text="Status" ></asp:Label>
<br />
<asp:DropDownList ID="ddStatus" runat="server" Width="152px" >
</asp:DropDownList>
</div>
</div>
</div>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
UPDATE:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<style type="text/css">
#main {
width: 800px;
}
#select {
float: left;
width: 250px;
border: 1px solid blue ;
}
#holder {
position: relative;
width: 300px;
float: left;
margin-left: 20px;
border: 1px solid red ;
}
#div_date, #div_subject, #div_status {
position: absolute;
top: 0;
left: 0;
}
#button {
float: left;
margin-left:20px
}
</style>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript">
$(document).ready(function () {
$('#filterResultsBy').change(function () {
var sel = $(this).val();
$('#div_date').hide();
$('#div_subject').hide();
$('#div_status').hide();
if (sel === 'Date') {
$('#div_date').show();
}
else if (sel == 'Subject') {
$('#div_subject').show();
}
else if (sel == 'Status') {
$('#div_status').show();
}
});
});
</script>
<div id="main">
<div id="select">
Filter Results by:
<select id="filterResultsBy">
<option value="">Select...</option>
<option value="Date">Date</option>
<option value="Subject">Subject</option>
<option value="Status">Status</option>
</select>
</div>
<div id="holder">
<div id="div_date" style="width: 250px; display: none;" >
Date Range:
<asp:textbox width="50px" id="startdate" runat="server" /> - to - <asp:textbox width="50px" id="enddate" runat="server" />
</div>
<div id="div_subject" style="display: none;" >
Subject:
<asp:TextBox ID="txtSubject" runat="server" Width="225px" ></asp:TextBox>
</div>
<div id="div_status" style="display: none;" >
Status:
<asp:DropDownList ID="ddlStatus" runat="server" Width="152px">
</asp:DropDownList>
</div>
</div>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
</div>
</form>
</body>
</html>
Sure, not a problem. You can clean up your markup a bit on the div's that appear by removing the nested <div style="float: left">. The CSS would be as follows:
select {
float: left;
}
#divDateRangeSearch, #divSearchSubject, #divStatusSearch, #btnSearch {
float: left;
margin-left: 20px; /* put some space between the elements */
}
The above assumes that you're creating and destroying the respected <div>'s as you hide and show them. If you need them to all exist in the source and you'll show and hide them, you'll need something like the following:
#divHolder {
position: relative;
float: left;
width: 200px; /* adjust as needed */
}
#divDateRangeSearch, #divSearchSubject, #divStatusSearch {
position: absolute;
top: 0;
left: 0;
}
And the HTML:
<div id="divHolder">
<!-- Markup for the 3 divs would go in here -->
</div>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
Try the following. You'll have to add your other two divs back in, and I'm assuming you toggle their visibility based on selection.
<div style="width: 880px; padding-top: 2px; border-bottom: none;
height: 28px;">
<div style="float:left">
<asp:Label ID="lblFilterResultsBy" runat="server" Text="Filter Results by:"></asp:Label>
<asp:DropDownList ID="ddlFilter" runat="server" Width="221px">
<asp:ListItem Text="Select..." Value=""></asp:ListItem>
<asp:ListItem Text="Date" Value="DATE"></asp:ListItem>
<asp:ListItem Text="Subject" Value="SUBJECT"></asp:ListItem>
<asp:ListItem Text="Status" Value="STATUS"></asp:ListItem>
</asp:DropDownList>
</div>
<div id="divStatusSearch">
<div style="float: left">
<asp:Label ID="lblStatus" runat="server" Text="Status" ></asp:Label>
<asp:DropDownList ID="ddStatus" runat="server" Width="152px" >
</asp:DropDownList>
</div>
</div>
<div style="float:left">
<asp:Button ID="btnSearch" Text="Search" runat="server" />
</div>

I can't get the panels within my panel to center

They all appear left aligned. I've tried setting the body tag to text-align:center, making divs around and in the main panel, but I can't get it to work. Any ideas?
Here is my CSS code:
.MainPanel {
background-color:#ccccff;
margin-bottom:10px;
margin-top:10px;
}
.MainPanel div {
margin-bottom:10px;
margin-top:10px;
}
.panelSpace {
margin-bottom:25px;
margin-top:25px;
}
.buttonWidth { clear: both; }
.buttonWidth div {
width:17%;
float:left;
margin-left:20px;
}
.centerDiv {
width:100%;
text-align:center;
}
And here's my html:
<body>
<form id="form1" runat="server">
<div style="height:100px; text-align:center;"><uc1:Header ID="Header1" runat="server" /></div><br /><br />
<div>
<div><asp:Label runat="server" ID="lblErrorMessage" CssClass="lblErrorMessage" /></div>
<asp:Panel ID="Panel0" runat="server" BackColor="#9999CC" BorderColor="DarkBlue" BorderWidth="2px">
<div class="centerDiv">
<div>
<asp:Panel ID="Panel1" runat="server" CssClass="MainPanel" Width="550" BorderColor="DarkBlue" BorderWidth="2px" >
<div>Customer: <asp:DropDownList ID="ddlCustomerList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCustomerList_SelectedIndexChanged" /></div>
</asp:Panel>
</div>
<span class="panelSpace" />
<asp:Panel ID="Panel2" runat="server" CssClass="MainPanel" Width="700" BorderColor="DarkBlue" BorderWidth="2px" style="overflow:auto;" >
<div>
<div class="buttonWidth">
<div>
<asp:Label ID="lblDataSync" runat="server" Text="Data Sync" /><br />
<asp:ImageButton ID="imgDataSync" ImageUrl=".\images\data_sync.bmp" runat="server"
Width="50px" Height="50px" OnClick="imgDataSync_Click" />
</div>
<div>
<asp:Label ID="lblEDI" runat="server" Text="EDI" /><br />
<asp:ImageButton ID="imgEDI" ImageUrl=".\images\edi.jpg" runat="server" Width="50px"
Height="50px" OnClick="imgEDI_Click" />
</div>
<div>
<asp:Label ID="lblShipping" runat="server" Text="Shipping/Routing" /><br />
<asp:ImageButton ID="imgShipping" ImageUrl=".\images\shipping_routing.jpg" runat="server"
Width="50px" Height="50px" OnClick="imgShipping_Click" />
</div>
<div>
<asp:Label ID="lblCompliance" runat="server" Text="Compliance/non-Compliant" /><br />
<asp:ImageButton ID="imgCompliance" ImageUrl=".\images\compliance_nc.jpg" runat="server"
Width="50px" Height="50px" OnClick="imgCompliance_Click" />
</div>
<div>
<asp:Label ID="lblLabels" runat="server" Text="Labels"></asp:Label><br />
<asp:ImageButton ID="imgLabels" ImageUrl=".\images\shipping_label.jpg" runat="server"
Width="50px" Height="50px" OnClick="imgLabels_Click" />
</div>
</div>
<div class="buttonWidth">
<div>
<asp:Label ID="lblManuals" runat="server" Text="Manuals/CustomerLinks" /><br />
<asp:ImageButton ID="imgManuals" ImageUrl=".\images\manuals.bmp" runat="server" Width="50px"
Height="50px" OnClick="imgManuals_Click" />
</div>
<div>
<asp:Label ID="lblPackaging" runat="server" Text="Packaging" /><br />
<asp:ImageButton ID="imgPackaging" ImageUrl=".\images\packaging.gif" runat="server"
Width="50px" Height="50px" OnClick="imgPackaging_Click" />
</div>
<div>
<asp:Label ID="lblTesting" runat="server" Text="Testing"></asp:Label><br />
<asp:ImageButton ID="imgTesting" ImageUrl=".\images\testing.jpg" runat="server" Width="50px"
Height="50px" OnClick="imgTesting_Click" />
</div>
<div>
<asp:Label ID="lblShippingQuickReference" runat="server" Text="Shipping Quick Reference"></asp:Label><br />
<asp:ImageButton ID="imgShippingQuickReference" ImageUrl=".\images\ShippingQuickReference.jpg" runat="server" Width="50px"
Height="50px" OnClick="imgShippingQuickReference_Click" />
</div>
</div>
</div>
</asp:Panel>
<span class="panelSpace" />
<asp:Panel ID="Panel3" runat="server" CssClass="MainPanel" Width="800" BorderColor="DarkBlue" BorderWidth="2px" >
<div>
<h2>Recent Updates:</h2>
<asp:GridView ID="grdHistory" runat="server">...</asp:GridView>
<asp:LinqDataSource ID="ldsHistory" runat="server" ContextTypeName="ComplianceDataContext"
TableName="Histories" OrderBy="CreatedDate desc" />
</div>
</asp:Panel>
<span class="panelSpace" />
</div>
</asp:Panel>
</div>
</form>
</body>
Set the width of the panels not in the ASP.NET code, but in the CSS declaration, e.g.
.MainPanel {
background-color:#ccccff;
margin-bottom:10px;
margin-top:10px;
width: 700px;
}
If you do not want to set the style for all panels, but for each panel, then do something like:
<asp:Panel ID="Panel1" runat="server" CssClass="MainPanel" style="width:550px" BorderColor="DarkBlue" BorderWidth="2px" >

Resources