需要以编程方式为 BulletedList 创建点击事件
我有以下 BulletedList,其中包含 ListItem。我需要为列表项提供一个 onclick 事件。
所以我的代码:
BulletedList ul = new BulletedList();
ul.ID = "paginationDyn";
ul.DisplayMode = BulletedListDisplayMode.LinkButton;
ul.Click = //What needs to come up here?
我必须在 ul.Click 属性中提供什么?还需要创建 click 方法。
谢谢
I have the following BulletedList with ListItem's in it. I need to give an onclick event to the listitems.
So my code:
BulletedList ul = new BulletedList();
ul.ID = "paginationDyn";
ul.DisplayMode = BulletedListDisplayMode.LinkButton;
ul.Click = //What needs to come up here?
What do I have to give in the ul.Click
property? And also click method needs to be created.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
然后在代码中的其他位置
如果您使用的是 Visual Studio,则可以通过键入
+=
来自动完成此操作然后按 Tab 键。
then else where in your code
If you are using Visual Studio, you can get auto completeion for this by typing the
+=
and then pressing tab.
我猜你想要的是:
I guess what you want is:
如果您想发起事件此页面说明了如何实施事件你自己的。
如果您只想引发 BulletedList 的内置事件,则需要创建一个调用 OnClick 的子类。
这将触发 BulletedList 的单击事件。
If you want to raise an event this page explains how to implement an event of your own.
If you just want to raise the built-in event of the BulletedList you need to create a sub class which calls OnClick.
This will fire the click event of the BulletedList.