Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
in grid view how to take the date format column using sql

and date will change daily in gridview

how t do that can any one tell me plz
Posted

 <asp:boundfield datafield="ModifiedDate" xmlns:asp="#unknown">
                    HeaderText="ModifiedDate" 
                    SortExpression="ModifiedDate" 
                    DataFormatString="{0:d}" />
</asp:boundfield>


See more inmsdn

For datagridview in windows application
you can define additional 'virtual' column with expression. but the better approach is use DefaultCellStyle.Format in the DataGridView. an example is here
 
Share this answer
 
v2
Comments
hilbert hussen 24-Apr-14 2:51am    
how to do in windows application
[no name] 24-Apr-14 3:33am    
see I have modified above content
Try this...

datagridview.Columns["column_name"].DefaultCellStyle.Format = "MM-dd-yyyy";
 
Share this answer
 

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