我怎样才能HtmlGenericControl的属性值? [英] How can i get the attribute value of HtmlGenericControl?

查看:208
本文介绍了我怎样才能HtmlGenericControl的属性值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建 HtmlGenericControl 是这样的:

HtmlGenericControl inner_li = new HtmlGenericControl("li");
inner_li.Attributes.Add("style", "list-style-type: none");


我怎样才能得到这个attribue的值(风格)。

推荐答案

您可以使用索引做到这一点:

You can do it using indexer:

var style = inner_li.Attributes["style"];

只是一个侧面说明:使用样式打交道时,最好使用<一个href=\"http://msdn.microsoft.com/en-us/library/d53fws1t%28v=vs.100%29.aspx\"><$c$c>HtmlControl.Style属性:

inner_li.Style[HtmlTextWriterStyle.ListStyleType] = "none";

这篇关于我怎样才能HtmlGenericControl的属性值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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