gpt4 book ai didi

c# - 为 RadioButtonList 项目添加工具提示

转载 作者:行者123 更新时间:2023-11-30 13:27:36 24 4
gpt4 key购买 nike

我的RadioButtonList绑定(bind)到数据库如下:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT ItemsID,ItemsDescription FROM Items", con);
adapter.Fill(subjects);
rblUseCases.DataSource = subjects;
rblUseCases.DataTextField = "ItemsDescription";
rblUseCases.DataValueField = "ItemsID";
rblUseCases.DataBind();

我需要添加一个新的工具提示,以便在用户将鼠标悬停在任何单选按钮周围时显示。我计划将工具提示文本添加为​​数据库表 Items 中的新列 Tooltip。如何将其数据绑定(bind)到单选按钮?

最佳答案

以下代码将在单选按钮上显示工具提示:

ListItem li=new ListItem("Manish","oopde");
li.Attributes.Add("title","zello");
RadioButtonList1.Items.Add(li);

对于数据绑定(bind),您可以遍历每个项目并向其添加属性。数据绑定(bind)和数据绑定(bind)事件不会调用每个项目,因此我们没有任何其他选项来实现相同的。

关于c# - 为 RadioButtonList 项目添加工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10071984/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com