Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
表单的c#.net回发不保留1个值_C#_Asp.net_Forms_Postback_Viewstate - Fatal编程技术网

表单的c#.net回发不保留1个值

表单的c#.net回发不保留1个值,c#,asp.net,forms,postback,viewstate,C#,Asp.net,Forms,Postback,Viewstate,对于我创建的表单的回发有一个奇怪的问题。答案可能很简单,但我似乎看不出来 我有一个表单,用户可以在视频页面不工作时填写。它根据当前选定的视频预先填充字段,并允许用户填写其他字段,并将电子邮件发送给我以获得支持 问题 字段已正确预填充,但其中一个字段“页面”虽然已正确预填充,但不会将值传递给button submit方法 客户端代码 (包括一些mootools javascript,这很有效) 生成的电子邮件 Name : User Email : user@test.com Other Fiel

对于我创建的表单的回发有一个奇怪的问题。答案可能很简单,但我似乎看不出来

我有一个表单,用户可以在视频页面不工作时填写。它根据当前选定的视频预先填充字段,并允许用户填写其他字段,并将电子邮件发送给我以获得支持

问题 字段已正确预填充,但其中一个字段“页面”虽然已正确预填充,但不会将值传递给button submit方法

客户端代码 (包括一些mootools javascript,这很有效)

生成的电子邮件

Name : User
Email : user@test.com
Other Field : aab123
Video ID : 5546
Browser : win, firefox 9
Flash Version : 11.102
Url referrer : 
Visible error messages : ewrwerwe
视频ID和页面/Url引用在(!IsPostBack)上填充

(!IsPostBack)

有什么想法吗?根据答案的简单程度,我有一堵砖墙可以把头撞过去

如果TextBox的ReadOnly属性为“true”,则回发数据不会被删除 它本质上意味着文本框是只读的 服务器端立场(客户端更改将被忽略)

如果希望TB以“旧方式”只读,请使用:

TextBox1.Attributes.Add(“只读”、“只读”)

因为这不会影响服务器端功能

发件人:


另请参见:

已解决:)

一缕阳光过后,我想起我有这个

RewriteRule ^/pop/(.*[^/])/report-issue/([a-fA-F0-9]{32})-([0-9]+)$ /pop.aspx?tp=$1&pg=report-issue&vid=$2&other=$3&ref=%{HTTP_REFERER} [L]
作为重写规则,这让我更仔细地观察表单字段是否真的被包装在回发中。瞧,他们不是

我包了一个包!在querystring变量读取部分进行回发,它可以正常工作

砖墙需要很厚


感谢那些试图帮助的人

查看此
txtdevideopage.ReadOnly=true
,您可以使用
Request.Form
获取值作为附录,如果我删除只读,并将任何值放入其中,而不仅仅是url,则该值仍然不会传递给看起来有用的click方法,但是我还有另一个textbox变量,该变量也以与txtVideoPage相同的方式设置为只读(并且预先填充了一个值,以相同的方式),该值可以将其文本值毫无问题地传递给电子邮件。(我没有包含此变量,因为它包含私人信息)您能显示将readonly设置为该字段的代码吗?我只能将TXTDevideoPage视为readonly。并且您确定readonly属性是根据if情况设置的吗?注释掉该字段上的只读行仍然会给我留下相同的结果。传递了一个空变量
Name : User
Email : User@test.com
Other Field : aab123
Video Learning ID : 5546
Browser version : win, firefox 9
Flash version : 11.102
Page : https://www.awebsite.com/library/video/5546
Visible error messages : ewrwerwe
Name : User
Email : user@test.com
Other Field : aab123
Video ID : 5546
Browser : win, firefox 9
Flash Version : 11.102
Url referrer : 
Visible error messages : ewrwerwe
pnlVideoProblem.Visible = true;
if (!String.IsNullOrEmpty(Request.QueryString["vid"]))
{
    txtVideoID.Text = Request.QueryString["vid"];
}

if (!String.IsNullOrEmpty(Request.QueryString["other"]))
{
    txtOtherField.Text = Request.QueryString["other"];
    txtOtherField.ReadOnly = true;
}
txtVideoPage.Text = HttpUtility.UrlDecode(Request.QueryString["ref"]);
txtVideoPage.ReadOnly = true;
RewriteRule ^/pop/(.*[^/])/report-issue/([a-fA-F0-9]{32})-([0-9]+)$ /pop.aspx?tp=$1&pg=report-issue&vid=$2&other=$3&ref=%{HTTP_REFERER} [L]