更改数据绑定上的复选框标签颜色
我到处寻找这个但找不到答案。我之前使用过以下代码来更改 asp.net 转发器中的重复项属性,因为它们被绑定到执行绑定之前无法执行的操作。
protected void rowRepeater_ItemBound(object sender, RepeaterItemEventArgs e)
{
foreach (RepeaterItem item in rptStockists.Items)
{
}
}
现在我想做类似的事情,但有一个复选框列表。我想更改标签的颜色,并且我知道我只能在绑定列表后才能执行此操作。我注意到复选框列表仅在智能感知中提供 OnDataBound 参数,而没有提供中继器那样的 OnItemDataBound 参数。我在这里可以使用的等效项是什么?
Ive searched everywhere for this but cant find the answer. I have used the following code before to change repeated items properties in an asp.net repeater as after they have been bound to do things i couldnt do prior to binding them.
protected void rowRepeater_ItemBound(object sender, RepeaterItemEventArgs e)
{
foreach (RepeaterItem item in rptStockists.Items)
{
}
}
Now i am wanting to do something similar but with a chekbox list. i want to change the colour of the labels and i know i can only do this after the list has been bound. I have notice checkboxlists only provide the parameter OnDataBound in intellisense, doesnt give me OnItemDataBound that repeaters do. What would be the equivalent i could use here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,您可以使用
DataBound
事件,例如:Well, you can use that
DataBound
event like: