i have 2 gridview control in my webpage, with two labels..
while exporting the webpage , the data are not displaying in ms-excel..
but the size of the excel document is showing as 155 bytes, but contents are not visible...what can i do
Please change your PageLoad event code. No need for checking the IsPostBack condition on pageload.
Protected Sub Page_Load(sender As Object, e As System.EventArgs) GridView1.Visible = True GridView2.Visible = True Using con As New SqlConnection(constr) Using cmd As New SqlCommand("select dept as Department,count(*) Male_Count from per_det where gen='male' and regno1 in(select distinct regno17 from proof ) group by dept") Dim dacust1 As New SqlDataAdapter() cmd.Connection = con dacust1.SelectCommand = cmd Using dt As New DataTable() dacust1.Fill(dt) GridView1.DataSource = dt GridView1.DataBind() End Using End Using End Using Using con As New SqlConnection(constr) Using cmd As New SqlCommand("select dept AS Department,count(*) Female_Count from per_det where gen='female' and regno1 in(select distinct regno17 from proof ) group by dept") Dim dacust1 As New SqlDataAdapter() cmd.Connection = con dacust1.SelectCommand = cmd Using dt As New DataTable() dacust1.Fill(dt) GridView2.DataSource = dt GridView2.DataBind() End Using End Using End Using End Sub
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.