asp.net - 属性集合属性 [英] asp.net - Attributes collection property

查看:142
本文介绍了asp.net - 属性集合属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么ASP.NET的属性集合属性控制/形式用的?

What the Attributes collection property for ASP.NET controls/forms are used for?

我们可以利用这个特性对于实现相同的功能的RegisterStartupScript()?

Can we use this property for achieving the same functionality as RegisterStartupScript() ?

推荐答案

它用于添加客户端的属性添加到服务器端控件。例如:

It's used for adding client-side attributes to a server-side control. For instance:

ButtonSubmit.Attributes.Add("onclick", "return confirm('Are you sure?');");

如果你能得到的HTML页面的标签的参考,你应该能够通过增加一个属性,像这样做同样的事情:

If you can get a reference to the HTML page's body tag, you should be able to do the same thing by adding an attribute like so:

BodyTag.Attributes.Add("onload", "myJavaScriptFunction();");

这篇关于asp.net - 属性集合属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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