zoukankan      html  css  js  c++  java
  • 关于控件的使用

    GridView

    <asp:GridView ID="GridView1" runat="server">

    <Columns>
    <asp:BoundField HeaderText="年度" DataField="Related_Party_Year" ItemStyle-Width="5%" />
    <asp:BoundField HeaderText="次別" DataField="Related_Party_Time" ItemStyle-Width="5%" />
    <asp:BoundField HeaderText="ID" DataField="ID1" ItemStyle-Width="10%" />
    <asp:BoundField HeaderText="姓名" DataField="Name" ItemStyle-Width="5%" />
    </Columns>

    </asp:GridView>

     HeaderText是表头显示的  ,DataField对应数据库中的栏位

    radioButton 

    GroupName="group" 用来设定一个组单选

    CheckBoxList复选框 RepeatDirection排列的方向

    <asp:CheckBoxList id="chkList" runat="server" RepeatDirection="Horizontal">
    <asp:ListItem >年度</asp:ListItem>
    <asp:ListItem >次別</asp:ListItem>
    <asp:ListItem >次別</asp:ListItem>
    <asp:ListItem >次別</asp:ListItem>
    </asp:CheckBoxList>

    循环选中的项

    foreach (ListItem chk in chkList.Items)
    {
         if (chk.Selected)
        { 
        }

    }

    如何通过全选选中其他的复选

    protected void chkAll_CheckedChanged(object sender, EventArgs e)
    {
             if (chkAll.Checked)
              {
                      chkList.Enabled = false;
                      for (int b = 0; b < chkList.Items.Count; b++)
                       {
                               this.chkList.Items[b].Selected = true;
                        }
                }
                 else
                 {
                        chkList.Enabled = true;
                        chkList.ClearSelection();
                   }
    }

     

    进入页面就绑定全选

      chkAll_CheckedChanged(null, null);

    111111
  • 相关阅读:
    最新国家标准下载(2020-7-31)
    SL/T 264-2020 水利水电工程岩石试验规程
    SH/T 3082-2019 石油化工仪表供电设计规范
    GB/T 4780-2020 汽车车身术语
    Java——冒泡排序
    JSP处理XML数据
    JSP标准标签库(JSTL)
    千锤百炼软工第十九天
    千锤百炼软工第十八天
    千锤百炼软工第十七天
  • 原文地址:https://www.cnblogs.com/whl4835349/p/5891714.html
Copyright © 2011-2022 走看看