我有一個網格視圖。如果沒有細節,我想讓它說「你沒有什麼可表現的東西」。asp.net GridView如果空顯示消息
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If GridView1.Rows.Count = 0 Then
Lblemptygridview.Text = "you do no details to show"
Elseif e.Row.RowType = DataControlRowType.DataRow then
Dim datakey As String = GridView1.DataKeys(e.Row.RowIndex).Value.ToString()
End If
End Sub
但是;它似乎在向後工作,並在數據要顯示在網格視圖中時顯示消息,並且在網格視圖中沒有要顯示的數據時仍然是空白頁面。
我試過了下面的IF語句下面的各種組合,但沒有成功。
打我吧:) – IrishChieftain 2012-04-02 19:03:44
哇這麼簡單!感謝球員:) – user1055487 2012-04-02 19:08:46