T
Tony Johansson
Hello!
I have added a table to the default page using the design mode. In the table
I have added some labels, textBoxes,dropdownlistbox and a button using the
design mode.
When I run this page I can see the table in the browser so all seems to work
fine.
But if I add this statement form1.InnerText = "This is a test";
to the Page_Load statement then the table with the including controls will
not be displayed in the browser.
In the browser will only this text be displayed This is a Test
So my question is how can this row form1.InnerText = "This is a test";
in the Page_Load cause the the table with all the control not to be
displayed ??
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
<asp:Label ID="labelEvent" runat="server"
Text="Event:"></asp:Label>
</td>
<td style="width:100px">
<aspropDownList ID="dropDownListEvents" runat="server">
<asp:ListItem>SQL Server 2005 and XML</asp:ListItem>
<asp:ListItem>Office 2003 and XML</asp:ListItem>
<asp:ListItem>Introduction to ASP.NET</asp:ListItem>
</aspropDownList>
</td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="labelFirstname" runat="server"
Text="Firstname:"></asp:Label>
</td>
<td style="width: 100px">
<asp:TextBox ID="textFirstname" runat="server"
Height="16px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="labelLastname" runat="server"
Text="Lastname:"></asp:Label>
</td>
<td style="width: 100px">
<asp:TextBox ID="textLastname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="labelEmail" runat="server"
Text="Email:"></asp:Label>
</td>
<td style="width: 100px">
<asp:TextBox ID="textEmail" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 100px">
<asp:Button ID="buttonSubmit" runat="server" Text="Submit"
/>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
//Code behind file
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
form1.InnerText = "Detta är ett test";
}
}
I have added a table to the default page using the design mode. In the table
I have added some labels, textBoxes,dropdownlistbox and a button using the
design mode.
When I run this page I can see the table in the browser so all seems to work
fine.
But if I add this statement form1.InnerText = "This is a test";
to the Page_Load statement then the table with the including controls will
not be displayed in the browser.
In the browser will only this text be displayed This is a Test
So my question is how can this row form1.InnerText = "This is a test";
in the Page_Load cause the the table with all the control not to be
displayed ??
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
<asp:Label ID="labelEvent" runat="server"
Text="Event:"></asp:Label>
</td>
<td style="width:100px">
<aspropDownList ID="dropDownListEvents" runat="server">
<asp:ListItem>SQL Server 2005 and XML</asp:ListItem>
<asp:ListItem>Office 2003 and XML</asp:ListItem>
<asp:ListItem>Introduction to ASP.NET</asp:ListItem>
</aspropDownList>
</td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="labelFirstname" runat="server"
Text="Firstname:"></asp:Label>
</td>
<td style="width: 100px">
<asp:TextBox ID="textFirstname" runat="server"
Height="16px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="labelLastname" runat="server"
Text="Lastname:"></asp:Label>
</td>
<td style="width: 100px">
<asp:TextBox ID="textLastname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="labelEmail" runat="server"
Text="Email:"></asp:Label>
</td>
<td style="width: 100px">
<asp:TextBox ID="textEmail" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 100px">
<asp:Button ID="buttonSubmit" runat="server" Text="Submit"
/>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
//Code behind file
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
form1.InnerText = "Detta är ett test";
}
}