Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I am binding Excel sheet data in a grid view and it is working fine, but in excel sheet there is a date, which is coming like 7/27/2013 12:00:00 AM but in excel sheet it is 27/07/2013.

I need it in a format, when date field will come it will show in a format don't need time.
My code for bind excel sheet is :-
C#
OleDbConnection oconn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + file_name + ";Extended Properties=Excel 8.0");
                OleDbCommand ocmd = new OleDbCommand("select * from [Requisition$]", oconn);
                oconn.Open();
                OleDbDataReader odr = ocmd.ExecuteReader();
                GridView1.DataSource = odr;
                GridView1.DataBind();
                oconn.Close();

if any solution then please help.

Thanks..
Posted
Updated 17-Aug-13 7:57am
v3

1 solution

Concerning to date you can pass this as Text='' or HeaderText = ''

<%# Bind("Failure_date", "{0:dd/MM/yyyy}") %>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900