• 关于控件的使用


    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
  • 相关阅读:
    姐姐的vue(1)
    LeetCode 64. Minimum Path Sum 20170515
    LeetCode 56. 56. Merge Intervals 20170508
    LeetCode 26. Remove Duplicates from Sorted Array
    LeetCode 24. Swap Nodes in Pairs 20170424
    LeetCode 19. Remove Nth Node From End of List 20170417
    LeetCode No.9 Palindrome Number 20170410
    LeetCode No.8. String to Integer (atoi) 2017/4/10(补上一周)
    LeetCode No.7 Reverse Integer 2017/3/27
    LeetCode No.4 Median of Two Sorted Arrays 20170319
  • 原文地址:https://www.cnblogs.com/whl4835349/p/5891714.html
Copyright © 2020-2023  润新知