在ASP中的html服务器控件中htmlinputhidden的用途是什么 [英] what is the use of htmlinputhidden in html server control in asp

查看:123
本文介绍了在ASP中的html服务器控件中htmlinputhidden的用途是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否告诉我asp.net的html服务器控件中htmlinputhidden的用途是什么?
我的意思是说,这种控件以什么方式可以帮助创建网站
问候
shivani

Can you please tell me what is the use of htmlinputhidden in html server control in asp.net?
I mean in what way this control can be helpful in creating a web site
regards
shivani

推荐答案

请参阅MSDN,这非常简单.
http://msdn.microsoft.com/en-us/library/k65s5xs3 (v = VS.90).aspx [
Refer to MSDN, it is quite simple.
http://msdn.microsoft.com/en-us/library/k65s5xs3(v=VS.90).aspx[^]


隐藏字段用于存储值.可以通过页面进行访问.

我们可以将任何变量的值存储到隐藏字段中,然后在该页面的任何函数中调用它们.

例如:-
Hidden Fields are used to store values. It is accessible through out the page.

We can store the value of any variable to the hidden field and then call them in any function in that page.

Eg:-
..Page_Load(){
int x=25;
HiddenField1.Value=x.ToString();
}

public void SomeFunction()
{
int y=Convert.ToInt(HiddenField1.Value);
}


隐藏字段是一种将信息从一页传递到另一页的方法(如果第一页执行回发),或者是从客户端(即Javascript)代码传递和检索信息.

ASP.net可以为您处理大多数回发方案(通过在页面上暂存一堆隐藏字段),并且如今与客户端脚本进行回发驱动的通信被认为是糟糕的用户体验,因此对于普通现代网站中的隐藏字段.
Hidden fields are a way of passing information from one page to another, if the first page does a postback, or passing and retrieving information from client side (i.e. Javascript) code.

ASP.net handles most postback scenarios for you (by parking a stack of hidden fields on the page, incidentally), and postback-driven communication with client side scripts is considered to be poor user experience these days, so there is not much use for hidden fields in an average modern website.


这篇关于在ASP中的html服务器控件中htmlinputhidden的用途是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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