zoukankan      html  css  js  c++  java
  • GridView中如何取得隐藏列的值?

    直接对 <asp:BoundField  隐藏列取值不行,改用模板列实现

    <asp:TemplateField Visible="false">
                        
    <ItemTemplate>
                            
    <asp:label ID="lblTask" runat="server" Text='<%# Eval("task_status") %>' />
                        
    </ItemTemplate>
                
    </asp:TemplateField>

    然后,

    protected void SmartGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        
    {
            
    if (e.Row.RowType == DataControlRowType.DataRow)
            
    {
                
    switch (((Label)e.Row.FindControl("lblTask")).Text)
                
    {
                    
    case "0":
                        e.Row.CssClass 
    = "color_task_init";
                        
    break;
                    
    case "1":
                        e.Row.CssClass 
    = "color_task_back";
                        
    break;
                    
    case "2":
                        e.Row.CssClass 
    = "color_task_wait";
                        
    break;
                    
    case "3":
                        e.Row.CssClass 
    = "color_task_confirm";
                        
    break;
                    
    case "4":
                        e.Row.CssClass 
    = "color_task_finish";
                        
    break;
                    
    case "10":
                        e.Row.CssClass 
    = "color_task_cancel";
                        
    break;
                    
    case "&nbsp;":
                        e.Row.CssClass 
    = "color_terminal";
                        
    break;
                    
    default:
                        e.Row.CssClass 
    = "color_terminal";
                        
    break;
                }

            }

        }

  • 相关阅读:
    ElasticSearch(十二):Spring Data ElasticSearch 的使用(二)
    ElasticSearch(十):Elasticsearch集群配置
    Linux下设置postgresql数据库开机启动
    PostgreSQL分区表实现——pg_pathman安装、配置
    Postgresql日志配置
    Linux CentOS 7 安装PostgreSQL 9.5.17 (源码编译)
    Docker(5):Docker镜像基本操作(上)
    数学建模之路----遗传算法
    MATBLAB学习笔记----基础绘图
    ffmpeg音频视频转格式工具使用
  • 原文地址:https://www.cnblogs.com/silva/p/874403.html
Copyright © 2011-2022 走看看