HtmlForm.SubmitDisabledControls 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
클라이언트에서 비활성화된 컨트롤이 해당 값을 제출하도록 강제 적용할지 여부를 나타내는 부울 값을 가져오거나 설정하여 페이지가 서버에 다시 게시된 후 해당 값을 유지할 수 있도록 합니다.
public:
virtual property bool SubmitDisabledControls { bool get(); void set(bool value); };
public virtual bool SubmitDisabledControls { get; set; }
member this.SubmitDisabledControls : bool with get, set
Public Overridable Property SubmitDisabledControls As Boolean
속성 값
true클라이언트에서 사용하지 않도록 설정된 컨트롤이 해당 값을 제출하도록 강제 적용되면 이고, 그렇지 않으면 . false 기본값은 false입니다.
예제
다음 코드 예제에서는 페이지가 서버에 다시 게시 된 후 해당 값을 유지 하도록 클라이언트 스크립트에서 사용 안 함 컨트롤을 발생 하려면 폼 true 에 속성을 설정 SubmitDisabledControls 하는 방법을 보여 줍니다. 이 예제에서는 속성을 false 설정한 SubmitDisabledControls 다음 뒤로 게시 단추를 클릭하면 HTML 텍스트 상자의 텍스트가 손실되고 HTML 확인란이 더 이상 선택되지 않습니다.
<%@ 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 xmlns="http://www.w3.org/1999/xhtml" >
<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>
<%@ 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 xmlns="http://www.w3.org/1999/xhtml" >
<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>
설명
SubmitDisabledControls 이 속성을 사용하여 페이지가 다시 게시될 때 클라이언트에서 비활성화된 컨트롤이 해당 값을 제출하도록 강제할지 여부를 지정합니다. 이렇게 하면 페이지가 서버에 다시 게시된 후 비활성화된 컨트롤이 해당 값을 유지할 수 있습니다. 속성이 SubmitDisabledControls 설정 false되면 클라이언트 스크립트를 사용하여 사용하지 않도록 설정된 양식의 컨트롤은 다음에 페이지가 다시 게시될 때 서버에 제출되지 않습니다. 따라서 비활성화된 컨트롤에 의해 저장된 모든 값이 손실됩니다. 페이지가 서버에 다시 게시된 후 비활성화된 컨트롤이 해당 값을 유지할 수 있도록 하려면 속성을 true.로 설정합니다SubmitDisabledControls.