制作文本框隐藏在ASP.NET [英] Making text box hidden in ASP.NET

查看:214
本文介绍了制作文本框隐藏在ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET 3.5和C#。

在我的网页,我需要有一个文本框,绝不能对用户可见的,但是当你在看网页源代码它必须在那里,原因是,从另一个名为Eloqua计划将寻求在页面的源代码,并要把那个文本框的值。

这文本框的值将根据用户选择什么来填充。

因此​​,我不能设置文本框属性为Visible = false,因为那不会是在HTML源代码,我不能设置启用=假,因为我不想让用户看到的文本框。

有一些属性,我可以使用,使这个文本框隐藏用户,但在页面的源代码仍然可见?

我的ASP.NET文本框

 < ASP:文本框ID =txtTester=服务器>< / ASP:文本框>


解决方案

您可以使用隐藏域。

 < ASP:HiddenField ID =myHiddenInput=服务器/>

使用它就像一个文本框。

I am using ASP.NET 3.5 and C#.

On my page I need to have a Text box that must not be visible to the user but it MUST be there when you look at the Page Source, reason being, another program called Eloqua will be looking at the page source and it must get the value of that text box.

The value of that text box will be populated based on what the user selects.

Thus, I cant set the text box property to Visible = False because then it will not be in the source HTML and I can't set the Enabled = False because I do not want the user to see the text box.

Is there some property I can use to make this text box hidden to the user but still visible in the page source?

My ASP.NET text box

<asp:TextBox ID="txtTester" runat="server"></asp:TextBox>

解决方案

You can use a hidden field.

<asp:HiddenField id="myHiddenInput" runat="server" />

Use it just like a textbox.

这篇关于制作文本框隐藏在ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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