Get Date Only from DateTime in GridView

Howdy Folks,

I'm loading a GridView from an Access DataBase. 

I've been trying every thing I can come up with trying to figure out how to get the Date only from a GridView Field. I've used a TableAdapter/DataTable, AccessDataSource, and Custom SQL Statements to load the GridView. No matter what I do, the field always has "12:00:00 AM" attached to the Date.

The Date is set to Short Date in the Access DataBase 

I used the following code which takes the field item and formats it to ShortDate, IF I put the result in a TextBox. But when I put it in the GridView the time is always attached.

Dim dtDate As DateTime
FormatDateTime(aDate, DateFormat.ShortDate)

I've searched ASP.Net and the Internet and found many posts about this same issue but no issues that were solved.

Can you help me out with this.

Using, VWD, .Net FX 2.0, and SQL Server Express.

Thanks^3 

This line also works for a TextBox:  FormatDateTime(aDate, 2)


 


 

0
hypercode
12/23/2006 5:23:44 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
1989 Views

Similar Articles

[PageSpeed] 54

Add a DataFormatString

<asp:BoundField DataFormatString="{0:d}" />
 
Mike Banavige
~~~~~~~~~~~~
Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/
0
mbanavige
12/23/2006 6:06:14 PM

mbanavige,

Many Thanks for the help. The line you gave got me on the right track. I had to add to change the html encoding and then it worked like a charm. Thanks again.

 
0
hypercode
12/24/2006 1:03:55 AM
Reply:

Similar Artilces:

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: http://forums.asp.net/t/1069245.aspx Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

Getting the control id of a control inside gridview control
 uhmm.. a little bit confusing regarding my subject because i dont know how to say it...by the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id??  hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) What do you want's to do by getting the id of the Text box? Do you want's to find particular Textbox with certain id ? Kamran ShahidSr. Software Engineer(MCP,MCAD.net,MC...

GridView and Javascript
Hey All, I need help from  you. I have a GridView. In the  Edit Item template of the first Column I have a textbox, an user control and hidden field. When I click on the user control it  opens a pop up from which I can choose the required value. The text value is populated in the textbox and Id in the hidden field. Here's the code for edit template.         <EditItemTemplate>                        <table cellpaddin...

GridView child of GridView
I have a Parent GridView and when you click in the Edit one of the columns has a Template Field which has a Child GridView. When you click Edit on the Child GridView I have a Template Field that has a TextBox. How to I retreive this value of the TextBox? GridViewParent-- GridViewChild (Edit - Template Field containing this GridViewChild)----- TextBox inside Template Field in GridViewChild. Thank you.Peace in ChristMarco Napolihttp://www.ourlovingmother.org What you can do as a solution is to override the RowDataBound and try to find the child GridView control. Once you get a reference to...

get only date from a date with a datetime format
i have a problem with dates when it comes to searchingbasically, SQL searches for a date including the seconds,but i only need to date so that in any given time, it will yield a result.here's a part of my code-behind code: reqNo = RequisitionsLogic.GetReqNoByDate(currentDate, requestorCode)and here's the SQL statement created in a TableAdapter:SELECT RequisitionNoFROM RequisitionsWHERE (RequisitionDate = @RequisitionDate) AND (RequestorCode = @RequestorCode) take a look with this, don't just accept influenceshttp://thedailyarr.tkhttp://www.ftpx.com/index...

getting today's date to appear on the .net web calendar control
try as I have i cannot get the today's date displayed at the bottom of my web calendar control.  is there any special option i should set on my calendar control properties ? Hi, what did you mean by at the bottom of my web calendar control ? Is is highlighting the day number of current date? Try this,Calendar1.SelectedDay = DateTime.NowCorrect me if I misunderstood your question. :)Alvin ChooiMicrosoft ASP.NET™ Enthusiast v1.1 / v2.0, Malaysia Blog : http://alvinzc.blogspot.com hi,   I can see the selected date eg if if do what you say:    Calendar1.Se...

Get date portion from DateTime (with DateTime property)
    private string _Date;    public string Date    {        get { return _Date; }        set { _Date = value; }    } objDados.Date = Convert.ToDateTime(drResult["APP_DATE"]).Date.ToString("dd/MM/yyyy"); If I replace _Date from string to DateTime, how can I get only date portion from DateTime? ThanksBest regards,Ivan Andrade Hi  you could always copy it. But I'd put the Date property to be of DateTime type. Something like:  &...

Cannot get a RowFilter in a GridView control to work with a DateTime data type using a Dropdownlist as the filtering method
Hello,  I have a DataView that I am using as the data source for a GridView control and when I add a DropDownList control into the header of any column type other than a DateTime type the filtering works fine on Postback from the dropdown.  I just cannot get it to work with a DateTime type.  Here is a little bit of the code: //Here's all the things I have tried:  //Value is a string representation of my DateTime type (i.e. "12/01/2007 12:04:00 AM")filter = propName + "=#" + Convert.ToDateTime(value) + "#"; filter = propName + "...

gridview control in another gridview control
Hi ia have a questioni have a gridview control which contains button in one colum.now my question is i need another gridview to be placed in the  first gidviewso that when i click on the button the second gridview will populate the data.now my question is how to place second gridview in first gridview.or is there any approach like first grid itself acting as parent and child.please help me  Hi sirikalavalapalli:                I think nested gridview will help you. Check this link and it will show you how...

Get controlID from control (textbox) inside another control (gridview)
Ok, so I've been trying to get a link within the edit item template of a gridview to open a new window.  I can do that fine, but when I try to pass the new window the controlID of the textbox to pass the value back to in the originating page I can't get the correct ID.  (that was a mouthful)  Maybe my code will explain better...  <EditItemTemplate> <asp:TextBox ID="EndTextBox" runat="server" Text='<%# Bind("endtime") %>'></asp:TextBox> <a href="javascript:;" onclick="window.open...

Getting Information from the Controls (TemplateField or BoundField ) from any of the Data Presentation Controls
Hello Everybody,I have a very important question for me.For example, I have a GridView.It has three BoundFields and one TemplateFieldI want to get information from any of the record (row,line etc ) using any of the BoundFields or TemplateFields.And also I want to accomplish this not only with GridView but also other Data Presentation Controls, DetailsView FormView and Repeater.Shortly, Can anybody help me how to refer Controls in GridView, FormView, DetailsView, RepeaterPS: I have searched in Google and many sites,forums. But I couldn't see any solution and see that many people ask the same ...

Help Req: !!! :- On Disabling Controls Present inside a Gridview control
Hi All, We have A requirement Where we have disable controls inside a grid.These controls can be textbox, DropDownlist (in TemplateField), ComandField present inside the grid.We have to call a generic method for doing the same .(since it can be done for multiple grid.) PFB the code snippet we use. Which disables all the controls inside the page.The bolded part of the code is used to loop inside a grid view.(Not Working.)Is this ideal way to deal with the requirement.Or can someone suggest be a better way.        public void DisableMe(Page p1, st...

How to define a global datetime format to display datetime field in Gridview control?
How to define a global datetime format to display datetime field in Gridview control?                       The CreateDate is a datetime field, it display default datetime format such as 1995-12-26 11:20:12 in Part A I hope it display a appointed format, so I set DataFormatString in Part B If I have many datetime fields in different GridView control, do I must set DataFormatString one by one? Thanks! //------------------------------------------Part A----------------------------...

Gridview
I have a gridview that contains a hyperlink control that pops up a calendar control (as a separate aspx page).  I assign a javascript to the NavigateUrl attribute of the hyperlink control to open the calendar window like so:                                 NavigateUrl="javascript:calendar_window=window.open('DatePicker.aspx?src=ctl00_ContentPlaceHolder1_GridView1_ctl08_txtInsertClassDate','calendar','width=165,height=135,top=400,left=400');calendar_window.focus()...

Web resources about - Get Date Only from DateTime in GridView - asp.net.presentation-controls

Is there a JQuery plugin to convert UTC datetimes to local user timezone?
If I have a tag: &lt;span class="utctime"&gt;2010-01-01 11:30 PM&lt;/span&gt; I would like a jquery script or plug in to convert every utctime ...


Targetprocess 3.7.3: Epic unit for Bug/Story cards, new DateTime functions in Webhook plugin
Webhook plugin supports new DateTime functions AddDays(DateTime date, int days) – Returns a new date with the number of days added. The number ...

Common Pitfalls when working with DateTime’s
In .NET, the DateTime structure provides us wonderful functionality, but this seemingly simple structure can cause a lot of headaches if you ...

Parsing Twitter Date format to .Net DateTime
Recently when I needed to parse the twitter datetime format into a .Net DateTime I found this post on the web showing how to do it. However, ...

C Sharp (programming language) - Wikipedia, the free encyclopedia
(pronounced see sharp ) is a multi-paradigm programming language encompassing strong typing , imperative , declarative , functional , generic ...

1753 - Wikipedia, the free encyclopedia
Language: English Afrikaans አማርኛ العربية Aragonés Asturianu Aymar aru Azərbaycanca বাংলা Bân-lâm-gú Basa Banyumasan Беларуская ‪Беларуская (тарашкевіца)‬ ...

Coded Smorgasbord: Schizophrenic Haiku Comments and More
... writes Malcom StandardResponse UnSubscribeNewsletterUserAccount( string opTinGUID,string email, string sellingRegion, string source, DateTime ...

Limburg.be - Welkom op de site van de provincie Limburg - Welkom_op_de_site_van_de_provincie_Limburg
visit wonen werken leven ontspannen infopunt home op trefwoord contactpersonen wegwijs sitemap print deze pagina Je bent hier: limburg.be Contact ...

Simples Ideias. Por Nando Vieira.
Simples Ideias Siga-me no Twitter Junho/2012 Usando o Vagrant como ambiente de desenvolvimento no Windows http://simplesideias.com.br/usando ...

Resources last updated: 1/8/2016 3:17:12 PM