如何在ASP.NET中访问HTML控件 [英] How to access HTML Control in ASP.NET

查看:51
本文介绍了如何在ASP.NET中访问HTML控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何访问HTML控件到asp.net代码文件?我想在页面加载中隐藏它们。但是他们无法访问。

请帮助我..提前谢谢

How to access HTML control to asp.net code file? I want to hide them in page load. But they can't be accessed.
Please help me..Thanks in advance

推荐答案

在控件中添加runat =server 。



例如:

add runat="server" in the control.

eg:
<br />
 <a id="somelink" runat="server" href="#"></a><br />


1。设置相同名称的id和name属性。

然后

var control1 = Request.Form [name_of_control];



2.将runat =server添加到控件中,然后您可以从代码隐藏中访问它们,就好像它们是< asp:______ xmlns:asp =#unknown>控制。
1. Set id and name property in same name.
then
var control1= Request.Form["name_of_control"];

2.Add runat="server" to the controls, and then you can access them from the code-behind almost as if they were <asp:______ xmlns:asp="#unknown"> controls.


类似的问题 - 获取asp.net中HTML输入框的值 [ ^ ]
Similar question - Get Value of HTML Input box in asp.net[^]


这篇关于如何在ASP.NET中访问HTML控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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