Click to Rate and Give Feedback
MSDN
MSDN Library

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
HtmlForm..::.SubmitDisabledControls Property

Gets or sets a Boolean value indicating whether to force controls disabled on the client to submit their values, allowing them to preserve their values after the page posts back to the server.

Namespace:  System.Web.UI.HtmlControls
Assembly:  System.Web (in System.Web.dll)
Visual Basic (Declaration)
Public Overridable Property SubmitDisabledControls As Boolean
Visual Basic (Usage)
Dim instance As HtmlForm
Dim value As Boolean

value = instance.SubmitDisabledControls

instance.SubmitDisabledControls = value
C#
public virtual bool SubmitDisabledControls { get; set; }
Visual C++
public:
virtual property bool SubmitDisabledControls {
    bool get ();
    void set (bool value);
}
JScript
public function get SubmitDisabledControls () : boolean
public function set SubmitDisabledControls (value : boolean)
ASP.NET
<asp:HtmlForm SubmitDisabledControls="True|False" />

Property Value

Type: System..::.Boolean
true if controls disabled on the client are forced to submit their values; otherwise, false. The default value is false.

Use the SubmitDisabledControls property to specify whether to force controls disabled on the client to submit their values when the page posts back. This allows the disabled controls to preserve their values after the page posts back to the server. When the SubmitDisabledControls property is set to false, controls on the form that have been disabled using client script will not be submitted to the server the next time the page posts back. As a result, any values stored by the disabled controls are lost. To allow the disabled controls to preserve their values after the page posts back to the server, set the SubmitDisabledControls property to true.

The following code example demonstrates how to set the SubmitDisabledControls property on a form to true to cause controls disabled by client script to maintain their values after the page posts back to the server. In this example, if you set the SubmitDisabledControls property to false and then click the Post back button, the text in the HTML text box is lost and the HTML check box is no longer selected.

Visual Basic
<%@ page language="VB"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

    ' The first time the page loads, set the values
    ' of the HtmlInputText and HtmlInputCheckBox controls.
    If Not IsPostBack Then
      InputText1.Value = "Test"
      InputCheckBox1.Checked = True
    End If

  End Sub

</script>

<html  >

<head id="Head1" 
      runat="server">

    <title>HtmlForm SubmitDisabledControls Property Example</title>

</head>

<body>

  <form id="form1" 
        submitdisabledcontrols="true" 
        runat="server">

      <h3>HtmlForm SubmitDisabledControls Property Example</h3>

      <input id="InputText1" 
             name="InputText1" 
             type="text" 
             runat="server" />

      <input id="InputCheckBox1" 
             name="InputCheckBox1" 
             type="Checkbox" 
             runat="server" />

      <asp:button id="PostBackButton"
                  text="Post back"
                  runat="server" />

  </form>    

</body>

</html>

<script type="text/javascript">

    // Disable the HTML controls on the form.
    document.all('InputText1').disabled = true;
    document.all('InputCheckBox1').disabled = true;

</script>

C#
<%@ page language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  void Page_Load(Object sender, EventArgs e)
  {

    // The first time the page loads, set the values
    // of the HtmlInputText and HtmlInputCheckBox controls.
    if (!IsPostBack)
    {
      InputText1.Value = "Test";
      InputCheckBox1.Checked = true;
    }
  }

</script>

<html  >

<head id="Head1" 
      runat="server">

    <title>HtmlForm SubmitDisabledControls Property Example</title>

</head>

<body>

  <form id="form1" 
        submitdisabledcontrols="true" 
        runat="server">

      <h3>HtmlForm SubmitDisabledControls Property Example</h3>

      <input id="InputText1" 
             name="InputText1" 
             type="text" 
             runat="server" />

      <input id="InputCheckBox1" 
             name="InputCheckBox1" 
             type="Checkbox" 
             runat="server" />

      <asp:button id="PostBackButton"
                  text="Post back"
                  runat="server" />

  </form>    

</body>

</html>

<script type="text/javascript">

    // Disable the HTML controls on the form.
    document.all('InputText1').disabled = true;
    document.all('InputCheckBox1').disabled = true;

</script>

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker