如何在C#中通过div中的tag / type查找控件 [英] how to find control by tag/type from div in C#

查看:213
本文介绍了如何在C#中通过div中的tag / type查找控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何使用标签名称/控件类型在div中找到控件。



例如:



我如何获得div中的所有文本框并应用一些常见的使用C#的所有文本框的样式?





i知道div.findcontrol但是只能通过控件ID进行搜索。有人可以帮帮我吗?

解决方案

看到这个.. :)



 input [type =text] {
font-size 8pt;
font-family Arial;
}


所以,如果你想通过它找到控制权标签,你需要循环te控件集合。看看这里:如何:使用Controls集合访问控件 [ ^ ]

hi all,
how can i find control inside a div using tag name / type of control.

for example :

how can i get all the text boxes inside a div and apply some common style for all text boxes using C#?


i know div.findcontrol but that will search by control id only. can someone please help me ?

解决方案

see this.. :)

input[type="text"] {
font-size: 8pt; 
font-family: Arial; 
}


So, if you would like to find control by its tag, you need to loop through te collection of controls. Have a look here: How to: Access Controls by using the Controls Collection[^]


这篇关于如何在C#中通过div中的tag / type查找控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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