zoukankan      html  css  js  c++  java
  • 空数据时显示GridView及设置网格线式样

        Private Sub GridView1_DataBinding(ByVal sender As ObjectByVal e As System.EventArgs) Handles GridView1.DataBinding
            
    '空数据时添加空行
            Dim dt As Object = sender.DataSource
            
    If dt.Rows.Count = 0 Then
                dt.Rows.Add(dt.NewRow())
            
    End If
        
    End Sub


        
    Private Sub GridView1_RowDataBound(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
            
    '隐藏添加的空行
            If e.Row.RowType <> DataControlRowType.Header AndAlso e.Row.RowType <> DataControlRowType.Footer AndAlso e.Row.RowIndex = 0 Then
                
    If String.IsNullOrEmpty(sender.DataKeys(e.Row.RowIndex).Value.ToString()) Then
                    e.Row.Visible 
    = False
                
    End If
            
    End If

            
    '设置网格线式样为边框式样
            For Each tc As TableCell In e.Row.Cells
                tc.ControlStyle.BorderStyle 
    = sender.BorderStyle
                tc.ControlStyle.BorderWidth 
    = sender.BorderWidth
            
    Next
        
    End Sub


        
    Private Sub GridView1_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles GridView1.PreRender
            
    '设置网格线颜色为边框颜色
            sender.Attributes("BorderColor"= System.Drawing.ColorTranslator.ToHtml(sender.BorderColor)
        
    End Sub
  • 相关阅读:
    gulp之webpack-stream模块
    AMD、CMD与commonJS
    gulp之gulp-replace模块
    gulp之gulp-uglify模块
    gulp之gulp-sequence模块
    规范-命名、词汇
    gulp之gulp-connect模块
    angularjs $injector:nomod
    because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled
    jxls2 java.lang.NegativeArraySizeException
  • 原文地址:https://www.cnblogs.com/SNS/p/1226478.html
Copyright © 2011-2022 走看看