Request.form返回隐藏字段的空值 [英] Request.form returning null value for hidden field

查看:182
本文介绍了Request.form返回隐藏字段的空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用request.form从prevoius页面获取隐藏字段的值,但其alwasys显示为空值或空值.
我正在使用server.tranfer转到下一页.

Hi,
I am using request.form to get the value of the hidden field from a prevoius page but its alwasys showing as null or empty value.
i am using server.tranfer to go to the next page.

how to solve this?

推荐答案

是实际的HiddenField还是将其visible属性设置为false的TextBox?

如果它是一个TextBox,并且其visible属性设置为false,则它将不会在页面上呈现,并且始终返回空.

隐藏字段需要定义为;
Is it an actual HiddenField or a TextBox that has its visible property set to false?

If it is a TextBox that has its visible property set to false then it will not be rendered on the page and always returns empty.

A hidden field needs to de defined as;
<asp:HiddenField ID="testHidden" Value="" runat="server"/>




or

HiddenField test = new HiddenField();
test.ID = "testHidden";
test.Value = string.Empty;
container.Controls.Add(test);


是一个隐藏字段.我将尝试在其中添加Value属性.
添加Value属性和不添加Value属性有什么区别?

还可以请您告诉我如何在隐藏字段中获取datagrid或复选框或下拉列表的值吗?

谢谢.
Yes its a hiddenfield.I will try by adding Value property to it.
What is the difference with adding Value property and without value property?

Also can you please tell me how to get the value of datagrid or checkbox or dropdownlist in a hiddenfield?

Thanks.


这篇关于Request.form返回隐藏字段的空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆