zoukankan      html  css  js  c++  java
  • 让用户更易看到选择了哪个选项

    用户反馈,单选项目,没能明显显示有选择中的是哪一个?原来是Insus.NET使用了一个RadioButtonList控件,显示了较多的项目,让用户去单选。默认的选中样式,引起用户反馈这个问题。钟对这个问题,Insus.NET稍做了一些程序修改,用户也接受了这个效果。可以看看:

     方法很简单,就是当选项被选中时,更改选中选项的前景色。

     <asp:RadioButtonList ID="RadioButtonListLaHao" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioButtonListLaHao_SelectedIndexChanged" RepeatColumns="20" RepeatDirection="Horizontal" Width="100%">
                    </asp:RadioButtonList>

    上面Html代码有两个地方要注意的,一就是RadioButtonList的 AutoPostBack="true"属性,另一个就是OnSelectedIndexChanged="RadioButtonListLaHao_SelectedIndexChanged"的事件。

    变更选中选项的前景色,就是在这个事件进行,可参考。

    View Code
     protected void RadioButtonListLaHao_SelectedIndexChanged(object sender, EventArgs e)
        {
            var rbl = sender as RadioButtonList;
            HighliehgSelectedItem(rbl);
        }

        private void HighliehgSelectedItem(RadioButtonList rbl)
        {
            foreach (ListItem li in rbl.Items)
            {
                if (li.Selected)
                {
                    li.Attributes.Add("style""color: red;");
                }
            }
        }
  • 相关阅读:
    阿里巴巴excel工具easyexcel 助你快速简单避免OOM
    IoC和AOP的理解
    WebSocket和kafka实现数据实时推送到前端
    Swagger使用指南
    转载:对于马老师对996的看法
    基础:新建个maven项目
    eclipse集成lombok
    多线程
    jar包

  • 原文地址:https://www.cnblogs.com/insus/p/2683216.html
Copyright © 2011-2022 走看看