Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Export as Excel using c# and enabling Sorting in Grid
Message
De
22/01/2015 00:52:45
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Titre:
Export as Excel using c# and enabling Sorting in Grid
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01614051
Message ID:
01614051
Vues:
33
Sir,
I showed data in GridView using C#. I want export it in Excel. Please help me how to do this.
below code is used to show gridview.
and also suggest how to enable sorting and delete feature in grid.

protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Session["sname"].ToString();
SqlConnection con = new SqlConnection("Server=SDCHO\\SQLEXPRESS;Database=LoginPage;Trusted_Connection=true");
con.Open();
SqlCommand CMD = new SqlCommand("select * from LeaveDataTable WHERE Lid=@CHK_ID2 AND Lpass=@CHK_PA2", con);
CMD.Parameters.AddWithValue("@CHK_ID2", Session["sid"]);
CMD.Parameters.AddWithValue("@CHK_PA2", Session["spass"]);
SqlDataReader reader = CMD.ExecuteReader();
GridView1.DataSource = reader;
GridView1.DataBind();
con.Close();
}
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform