如何在C#中的转发器中查找html标签? [英] How to Find a html tag in the repeater in C#?

查看:118
本文介绍了如何在C#中的转发器中查找html标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有转发器。我想要显示并隐藏条件



如何在C#中找到转发器中的html标签?


$ b在转发器中查找按钮的$ b我们编写此代码



I am have td in repeater. i want show and hide it on condition

How to Find a html tag from the repeater in C#?

for find button in repeater we write this code

Button btn=Repeater1.FindControl("Button1") as Button;





但对于html标签?





but for html a tag?

----- atag=Repeater1.FindControl("id of a tag") as -------;







填写--- ---- ???????




fill in the -------???????

推荐答案

你好behnam haji,

如你所知,什么是C#类hd的td标签?

所以你可以通过编写下面给出的代码在C#中强制转换td标签。



Hi behnam haji,
As you asked, what is the C# class for td tag of html?
So you can cast the td tag in C# by writing the code given below.

System.Web.UI.HtmlControls.HtmlTableCell atag = rpt.FindControl("id of a tag") as System.Web.UI.HtmlControls.HtmlTableCell;







// import namespace 
using System.Web.UI.HtmlControls;

// and 
HtmlTableCell atag = rpt.FindControl("id of a tag") as HtmlTableCell;







您还可以从 HtmlControls命名空间中看到更多html控件类


如果文本框中的Repeater1.FindControl(标签的id)为HTMLtextbox;
if in case of text box Repeater1.FindControl("id of a tag") as HTMLtextbox;


这篇关于如何在C#中的转发器中查找html标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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