.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

display only date from gridview to textbox

Posted By: deven     Posted Date: April 20, 2013    Points:5   Category :ASP.Net
i want to display only date into textbox from gridview It displays as 11/03/2013 12:00:00 AM but i want only date 11/03/2013 i database it is stored on date

i tried to modify my code as

<asp:TemplateField HeaderText="reg_dt" Visible="False">
<ItemTemplate>
<asp:Label ID="Label29" runat="server"
Text ='<%# Bind("reg_dt" ,"{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>


but it displays same as first format what changes should i do to display only date plz help me

I m using datepicker to select date into textbox

Responses
Author: Aamrapali Tamgadge             
Posted Date: April 22, 2013     Points: 20   

In your select query Write

Select Convert(char(20),reg_dt,101)'reh_dt' From Tablename

Software Programmer At OTIS ISRC
Author: Ashutosh Jha             
Posted Date: December 09, 2013     Points: 20   

In select query write -
select convert(char(20),reg_dt,code*)'reh_dt from tblname

code*- this may be 101/103/107 depending on the format of date you want.

Regards,
Ashutosh Jha
ashutosh741@gmail.com

http://www.tricksroad.com


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend