zoukankan      html  css  js  c++  java
  • 代码片段

    1.grid判断查看哪一行的CheckBox被选中      

    foreach(GridViewRow row in this.StudentGridView.Rows)
            {
                Control ctrl = row.FindControl("CheckBox");
             
                    if ((ctrl as CheckBox).Checked)
                    {
                        TableCellCollection cell = row.Cells;
                        string studentCode = cell[1].Text;
                     }                
             }

    2.递归

    // 清空控件内容
    private void ClearText(Control ctr) {
        for (int i = 0; i < ctr.Controls.Count; i++) {
            // 若当前控件内部包含其他控件则继续遍历
            if (ctr.Controls[i].Controls.Count > 0) {
                ClearText(ctr.Controls[i]);
            } else {
                // 判断控件类型,做相应处理
                if (ctr.Controls[i] is TextBox) {
                    TextBox txt = null;
                    txt = ctr.Controls[i] as TextBox;
                    txt.Text = string.Empty;
                } else if (ctr.Controls[i] is ComboBox) {
                    ComboBox cbo = null;
                    cbo = ctr.Controls[i] as ComboBox;
                    cbo.Text = string.Empty;
                }
            }
        }
    }
  • 相关阅读:
    C# 基本数据类型
    java二进制,原码、反码、补码、位运算
    .net邮件发送[c#]
    linux软件安装命令
    VB.net实现从ListView控件中异地获取文本内容源代码
    VB获得进程PID
    任意组合指令达到免杀
    免杀之等价替换法
    ASP技巧base64编码、解码函数
    看到一个思路新颖的下载者制作法
  • 原文地址:https://www.cnblogs.com/dodui/p/2369816.html
Copyright © 2011-2022 走看看