PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

The Diable property for HTML server control does not work

 
 
Tony Johansson
Guest
Posts: n/a
 
      8th May 2011
Hello!

Below I have the aspx page and the code behind file.
This question is just for learning.
In the code behind file I have set the HTML server control div property
Disable to true in this way
to DIV1.Disabled = true;
but it doesn't not have any effect. I thought it should disable the working
for this HTML server control.
So my question is why does it still work when I have set the Disable
property to true

//aspx page here
<%@ 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></title>
</head>
<body>
<form id="form1" runat="server">
<div id="DIV1" runat="server" style="font-family: Verdana; font-size:
large; background-color: #FFFF00; position: absolute;">
</div>
</form>
</body>
</html>

//Code behind file here
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DIV1.Disabled = true;
//Put user code to initialize the page here
DIV1.InnerHtml = "<h3>" + "The select box's style collection
contains:" + "</h3>";
//Create an object to move through style collection of the box DIV1
IEnumerator keys = DIV1.Style.Keys.GetEnumerator();
//Move to the next item and write its values untill reach the last
item

while (keys.MoveNext())
{
string key = (string)keys.Current;
DIV1.InnerHtml += key + "=" + DIV1.Style[key] + "<br>";
}
}
}
//Tony


 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      8th May 2011
On 08-05-2011 05:33, Tony Johansson wrote:
> Hello!
>
> Below I have the aspx page and the code behind file.
> This question is just for learning.
> In the code behind file I have set the HTML server control div property
> Disable to true in this way
> to DIV1.Disabled = true;
> but it doesn't not have any effect. I thought it should disable the working
> for this HTML server control.
> So my question is why does it still work when I have set the Disable
> property to true
>
> //aspx page here
> <%@ 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></title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div id="DIV1" runat="server" style="font-family: Verdana; font-size:
> large; background-color: #FFFF00; position: absolute;">
> </div>
> </form>
> </body>
> </html>
>
> //Code behind file here
> public partial class _Default : System.Web.UI.Page
> {
> protected void Page_Load(object sender, EventArgs e)
> {
> DIV1.Disabled = true;
> //Put user code to initialize the page here
> DIV1.InnerHtml = "<h3>" + "The select box's style collection
> contains:" + "</h3>";
> //Create an object to move through style collection of the box DIV1
> IEnumerator keys = DIV1.Style.Keys.GetEnumerator();
> //Move to the next item and write its values untill reach the last
> item
>
> while (keys.MoveNext())
> {
> string key = (string)keys.Current;
> DIV1.InnerHtml += key + "=" + DIV1.Style[key] + "<br>";
> }
> }
> }


http://msdn.microsoft.com/en-us/libr....disabled.aspx
says:

In the browser, a disabled element or control is read-only, with the
following added restrictions: its value is not submitted with the form,
the element or control cannot receive focus, and the element or control
is skipped when navigating the document by tabbing.

Arne
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6 Combo box text property equivalent in HTML Select control swapna.munukoti@gmail.com Microsoft ASP .NET 1 13th Nov 2007 02:22 PM
Accessing original (html tag) value of a control property HoustonFreeways Microsoft ASP .NET 2 17th May 2005 09:01 PM
Value property for password HTML server control Neil Zanella Microsoft ASP .NET 2 4th Jan 2005 12:34 PM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden Microsoft VB .NET 1 11th Oct 2003 08:09 PM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden Microsoft ASP .NET 1 11th Oct 2003 08:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:00 AM.