哪些值的浏览器收集的回传数据? [英] Which values browser collects as a postback data?
问题描述
当页面被回发到服务器,浏览器收集每个控件的当前值并将其粘贴在一起成为一个字符串。此回发的数据然后通过HTTP POST发送回服务器。
When page is to be posted back to the server, browser collects the current values of each control and pastes it together into a string. This postback data is then sent back to the server via HTTP POST.
Q1 - 除了控件的Text属性和的SelectedIndexChanged(因此除了用户输入的数据),是否有其他属性/这是由浏览器保存为回传数据的控制值
Q1 - Besides control’s Text attributes and SelectedIndexchanged ( thus besides user input data), are there other attributes/values of a control which are saved by a browser as postback data?
Q2 - 如果GridView控件,哪个值保存在回发一个浏览器?只有那些其中用户选择要编辑的行?
Q2 - In case of GridView, which values are saved by a browser on a postback? Only those in a row which the user chooses to edit?
字节
推荐答案
textarea的值
,选择
, 输入
和按钮
字段在后返回。每个值是一个键值对,其中的关键是名称
元素的属性。
The values of textarea
, select
, input
and button
fields are returned in the post. Each value is a key-value pair where the key is the name
property of the element.
我想我已经得到了所有包含在后数据的元素:
I think that I have got all the elements that include data in the post:
-
文本区域
:在值
属性为包括在内,即什么类型的文本区域
textarea
: Thevalue
propery is included, i.e. what's typed in the textarea.
选择
:在值
所选选项的属性包括在内。如果所选的选项没有一个值
指定的属性,在选项的文本使用。
select
: The value
property of the selected option is included. If the selected option doesn't have a value
property specified, the text of the option is used.
输入类型=文本
:在值
属性包含,即什么类型的输入字段。
input type="text"
: The value
property is included, i.e. what's typed in the input field.
输入类型=密码
:在值
属性包含,即什么类型的输入字段。
input type="password"
: The value
property is included, i.e. what's typed in the input field.
输入类型=提交
:如果该按钮被用于发送的形式,值
属性包含,即按钮上的文字。
input type="submit"
: If the button was used to send the form, the value
property is included, i.e. the text of the button.
输入类型=形象
:如果该按钮被用于发送的形式,对图像内的鼠标点击的坐标是在后发。名称为x和y坐标通过加入的.x和.Y的元素的名称创建
input type="image"
: If the button was used to send the form, the coordinates of the mouse click within the image is sent in the post. Names for the x and y coordinates are created by adding ".x" and ".y" to the name of the element.
输入类型=复选框
:如果复选框被选中,值
属性包含。如果元素没有值
属性指定的,上的值。
input type="checkbox"
: If the checkbox is checked, the value
property is included. If the element has no value
property specified, the value "on" is used.
输入类型=无线电
:在值
属性包含从每个选定项目组。 (A组是具有相同名称的单选按钮。)
input type="radio"
: The value
property is included from the selected item from each group. (A group is all radio buttons with the same name.)
输入类型=文件
:将选定的文件的内容包括,随着原始文件路径(或唯一的文件名,这取决于浏览器和安全设置)。
input type="file"
: The content of the selected file is included, along with the original file path (or only the file name, depending on browser and security settings).
输入类型=隐藏
:在值
属性包含
按钮
:如果该按钮被用于发送的形式,的innerText
属性包括,即与HTML标记删除的按钮上的文字。
button
: If the button was used to send the form, the innerText
property is included, i.e. the text of the button with any html markup removed.
A 文本框
控件呈现无论是作为输入类型=文本
,一个输入类型=密码
或文本区域
,根据文本模式
属性。 A 的DropDownList
控件呈现为选择
元素。 A 按钮
控件呈现为输入类型=提交
。 A 复选框
控件呈现为输入类型=复选框
。等等...查看呈现的HTML code,看看呈现实际的HTML元素。
A TextBox
control is rendered either as an input type="text"
, an input type="password"
or a textarea
, depending on the TextMode
property. A DropDownList
control is rendered as a select
element. A Button
control is rendered as an input type="submit"
. A CheckBox
control is rendered as an input type="checkbox"
. And so on... check the rendered html code to see what the actual html elements rendered are.
一个GridView中只包括在后的任何数据,如果它包含任何可编辑的表单字段,或者如果它导致回发(通过浏览列表为例)。当执行回发有存储在一对隐藏字段的一些信息,这样会导致回发,但本身不发送任何形式的数据(如一个LinkButton为例)任何控制会包括有关什么引起的回发信息。
A GridView only includes any data in the post if it contains any editable form fields, or if it causes a postback (by navigating in the list for example). When doing a postback there is some information stored in a pair of hidden fields, so any control that causes a postback but doesn't send any form data by itself (like a LinkButton for example) does include information about what caused the postback.
控件也可以把数据在ViewState,这是保存在一个隐藏字段的形式。这也包括在后,但它只是发送到浏览器,然后再返回,而不由浏览器被改变。
Controls may also put data in the ViewState, which is kept in a hidden field in the form. This is also included in the post, but it's just sent to the browser and back again without being changed by the browser.
这篇关于哪些值的浏览器收集的回传数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!