My scenario is,
I have created a page and made some changes by applying templates and gridview in Updatepanel.Now i have a footer template to add and insert the data to database.But it doesnt appear when the there is no data in datatable.
I need to show those footertemplate during page load event.and when i add it has to refresh the page to show the Datas. Please help on this
Page load event:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load, UpdatePanel1.Load
If Not IsPostBack Then
BindData()
End If
End Sub
Private Sub BindData()
Dim strQuery As String = "select MembershipName,FamilyMember,MemberName,Dateofbirth from IOMFamilyDetails "
Dim cmd As New SqlCommand(strQuery)
GridView1.DataSource = GetData(cmd)
GridView1.DataBind()
End Sub
There are several options.
Try to add an empty data row as described in this article
http://dotnetspidor.blogspot.com/2008/07/how-to-display-gridview-header-and.html
Create a custom gridview control by overriding the CreateChildControls method of the GridView control as described here http://mattberseth.com/blog/2007/07/how_to_show_header_and_footer.html
Sorry both of them in C#.