When I create a Table webcontrol programmatically (no static table tag in
the aspx file), it renders in the HTML with a border attribute set to "0".
If I add my own border attribute--MyTable.Attributes.Add("border",
"1")--with a value of "1", the border attribute shows up twice in the HTML
tag in the browser.
How can I suppress the default border attribute of "0" for the Table
webcontrol?
Thanks
Phil 4 3184
Code sample would help. Otherwise this could be about 10
different issues. -----Original Message----- When I create a Table webcontrol programmatically (no
static table tag inthe aspx file), it renders in the HTML with a border
attribute set to "0". If I add my own border attribute--MyTable.Attributes.Add
("border","1")--with a value of "1", the border attribute shows up
twice in the HTMLtag in the browser.
How can I suppress the default border attribute of "0"
for the Tablewebcontrol?
Thanks Phil
.
Pretty basic stuff here. Below you will find the code for the aspx file,
the c# code behind file, and the html markup taken from "view source" in the
browser window. Please note that the border attribute is repeated twice in
HTML file for the table.
The operating environment is:
-- VS.Net: 7.0
-- .Net Framework: 1.0
-- IE: 6.0
Thanks,
Phil
----------------
ASPX file:
----------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="TableBorder.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
</form>
</body>
</HTML>
----------------
Code behind:
----------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace TableBorder
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Table tbl = new Table();
tbl.Attributes["border"] = "1";
Control FormControl = FindControl("Form1");
FormControl.Controls.Add(tbl);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
----------------
HTML file
----------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwtMTI3OTMzNDM4NDs7Po6uD/OBrot+Jddth/EAV3CvXJRf" />
<table border="1" border="0">
</table></form>
</body>
</HTML>
Have you tried, instead of tbl.Attributes["border"] = "1";
simply
tbl.Border = 1; http://msdn.microsoft.com/library/en...ordertopic.asp
- Tom Kiefer
thogek @ earthlink . net
"Unknown" <un@known.com> wrote in message
news:Eb********************@speakeasy.net... Pretty basic stuff here. Below you will find the code for the aspx file, the c# code behind file, and the html markup taken from "view source" in
the browser window. Please note that the border attribute is repeated twice
in HTML file for the table.
The operating environment is: -- VS.Net: 7.0 -- .Net Framework: 1.0 -- IE: 6.0
Thanks, Phil
---------------- ASPX file: ----------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="TableBorder.WebForm1" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
</form>
</body> </HTML>
---------------- Code behind: ----------------
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;
namespace TableBorder { /// <summary> /// Summary description for WebForm1. /// </summary> public class WebForm1 : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { Table tbl = new Table();
tbl.Attributes["border"] = "1";
Control FormControl = FindControl("Form1");
FormControl.Controls.Add(tbl); }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }
---------------- HTML file ----------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1"> <input type="hidden" name="__VIEWSTATE" value="dDwtMTI3OTMzNDM4NDs7Po6uD/OBrot+Jddth/EAV3CvXJRf" />
<table border="1" border="0">
</table></form>
</body> </HTML>
Using "tbl.Border = 1" seems to create an inline CSS style; We want to use
only the border attribute of the table element in this particular case for a
number of unrelated reasons.
Phil
"Tom Kiefer" <th*******@earthlinknot.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl... Have you tried, instead of
tbl.Attributes["border"] = "1"; simply
tbl.Border = 1;
http://msdn.microsoft.com/library/en...ordertopic.asp - Tom Kiefer thogek @ earthlink . net
"Unknown" <un@known.com> wrote in message news:Eb********************@speakeasy.net... Pretty basic stuff here. Below you will find the code for the aspx
file, the c# code behind file, and the html markup taken from "view source" in
the browser window. Please note that the border attribute is repeated twice in HTML file for the table.
The operating environment is: -- VS.Net: 7.0 -- .Net Framework: 1.0 -- IE: 6.0
Thanks, Phil
---------------- ASPX file: ----------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TableBorder.WebForm1" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
</form>
</body> </HTML>
---------------- Code behind: ----------------
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;
namespace TableBorder { /// <summary> /// Summary description for WebForm1. /// </summary> public class WebForm1 : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { Table tbl = new Table();
tbl.Attributes["border"] = "1";
Control FormControl = FindControl("Form1");
FormControl.Controls.Add(tbl); }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }
---------------- HTML file ----------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1"> <input type="hidden" name="__VIEWSTATE" value="dDwtMTI3OTMzNDM4NDs7Po6uD/OBrot+Jddth/EAV3CvXJRf" />
<table border="1" border="0">
</table></form>
</body> </HTML>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Harry |
last post by:
Whats wrong with this?
top.document.frmMain.tabMain.border = "1";
thanks
|
by: Marek Mänd |
last post by:
When using <TABLE rules="all"> Mozilla 1.6 and previous versions
draw a nasty interiour border, which doesnt go away though I have
on TD's css border:none set.
Is it something wrong with my...
|
by: Mr. Clean |
last post by:
Apparently Mozilla/Firefox doesn't support the bordercolor attribute of
the table tag.
Here's what I do that works in IE:
<table border="1" cellpadding="2" cellspacing="0" width="380"...
|
by: Rolf Brauser |
last post by:
Hi,
I want to have a table with a border of 1px arround it but table="1" is more
than a pixel because this 3d effect is attached.
Values below are not accepted
How can I get this border with...
|
by: Bob Sanderson |
last post by:
I have a number of pages containing tables. Most have background images
which have a single pixel border. The tables themselves do not have
borders. For various reasons, I have to create one...
|
by: ireneatngs |
last post by:
Hi,
I have example html below which contains a couple of hidden divs.
However, some of the table borders within these hidden divs are
actually displayed when they should not be.
In my...
|
by: Vaclav Jedlicka |
last post by:
Hi
I need a datagrid on a page, but it is rendered with the style
"border-collapse:collapse;". I do not need this style. It interferes with
the settings in my CSS file. I tried to supress it...
|
by: Bill Endow |
last post by:
I've noticed that the WebControl.Table class always outputs the attribute "border="0"", and I cannot stop it from doing so, no matter what I try. I end up with generated HTML that looks like:
...
|
by: progdis |
last post by:
I want to apply css styles on a GridView, but there is some border
magic in it, which applies border styles on the table.
By default it sets an attribute border="0" on the table. If I set
border...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |