Hi Lucas,
I'm not quite sure what you need to know, but you can check the row type
each time a row is created and if it's the empty row, get a reference to the
content of the template.
Here's a little example. Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If Not IsPostBack Then
GridView1.DataSource = CreateEmptyDataSource()
GridView1.DataBind()
End If
End Sub
Function CreateEmptyDataSource() As Data.DataTable
Dim dt As New Data.DataTable
dt.Columns.Add(New Data.DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New Data.DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New Data.DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New Data.DataColumn _
("Boolean", GetType(Boolean)))
dt.Clear()
Return dt
End Function
Protected Sub GridView1_RowCreated _
(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.EmptyDataRow Then
Dim lbl As Label
lbl = e.Row.FindControl("lblEmpty")
lbl.Text = "Okay this is the empty text"
End If
End Sub
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Get a reference to an empty data message</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:gridview id="GridView1" runat="server"
onrowcreated="GridView1_RowCreated">
<emptydatatemplate>
<asp:label runat="server" id="lblEmpty"
text="Empty, eh?"></asp:label>
</emptydatatemplate>
</asp:gridview>
</div>
</form>
</body>
</html>