473,803 Members | 4,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can i show DATAGRID date with out any time frame.

Hi All
I was poplating Datagrid
Datagrid has one of the column showing datetime field format iam showing
DATE here not Necessary to populate the Time Frame
Even my datebase column also does'nt have any time frame Query is shoing
only dates;
But ASP.NET dategrid showing Time frame also,
How can remove the time frame in datagrid
<asp:Label ID="lblWorker" Text='<%DataBin der.Eval(Contai ner.DataItem,
"dateissue" )%>' Runat=server />
How can i format this Without date
Date base query is showing - DateIssued Column :1997-26-10
But Ineed Only date:
Datagrid showing lik this :
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997 12:00:00
AM
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997 12:00:00
AM
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997 12:00:00
AM

Regards,
Venu
Nov 16 '05 #1
4 2697
Hi,

You have to use the DateTime.ToShor tDateString() for this.

Now the tricky thing is that the DataBinder.Eval does only support a
property or field, not a method, so you cannot use it. so you have to
convert Container.DataI tem to the correct type , says DataRow and then
convert the column to DateTime and do the calling:

try this:
DataBinder.Eval (Container.Data Item,"dateissue .ToShortDateStr ing() ")%

<%#
((DateTime)((Da taRow)Container .DataItem)["RowName"]).ToShortDateSt ring() %>

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"karunakar" <ka***********@ stcroixsystems. com> wrote in message
news:uk******** ******@TK2MSFTN GP14.phx.gbl...
Hi All
I was poplating Datagrid
Datagrid has one of the column showing datetime field format iam showing
DATE here not Necessary to populate the Time Frame
Even my datebase column also does'nt have any time frame Query is shoing
only dates;
But ASP.NET dategrid showing Time frame also,
How can remove the time frame in datagrid
<asp:Label ID="lblWorker" Text='<%DataBin der.Eval(Contai ner.DataItem,
"dateissue" )%>' Runat=server />
How can i format this Without date
Date base query is showing - DateIssued Column :1997-26-10
But Ineed Only date:
Datagrid showing lik this :
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997 12:00:00
AM
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997 12:00:00
AM
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00
AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997 12:00:00
AM

Regards,
Venu

Nov 16 '05 #2
Hi All
Iam Binding like this

<asp:TemplateCo lumn>
<HeaderTemplate >
dateIssued
</HeaderTemplate>
<ItemTemplate >
<asp:Label ID="Label2" Text='<%#
((DateTime)((Da taRow)Container .DataItem)["datecomple te"]).ToShortDateSt ring(
)%>' Runat=server />
</ItemTemplate>
</asp:TemplateCol umn>
Here ["datecomple te"] this is column name
I doing like this.
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'DataRow' could
not be found (are you missing a using directive or an assembly reference?)

It's giving Error like this

Regards
venu

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:eo******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

You have to use the DateTime.ToShor tDateString() for this.

Now the tricky thing is that the DataBinder.Eval does only support a
property or field, not a method, so you cannot use it. so you have to
convert Container.DataI tem to the correct type , says DataRow and then
convert the column to DateTime and do the calling:

try this:
DataBinder.Eval (Container.Data Item,"dateissue .ToShortDateStr ing() ")%

<%#
((DateTime)((Da taRow)Container .DataItem)["RowName"]).ToShortDateSt ring() %>
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"karunakar" <ka***********@ stcroixsystems. com> wrote in message
news:uk******** ******@TK2MSFTN GP14.phx.gbl...
Hi All
I was poplating Datagrid
Datagrid has one of the column showing datetime field format iam showing DATE here not Necessary to populate the Time Frame
Even my datebase column also does'nt have any time frame Query is shoing
only dates;
But ASP.NET dategrid showing Time frame also,
How can remove the time frame in datagrid
<asp:Label ID="lblWorker" Text='<%DataBin der.Eval(Contai ner.DataItem,
"dateissue" )%>' Runat=server />
How can i format this Without date
Date base query is showing - DateIssued Column :1997-26-10
But Ineed Only date:
Datagrid showing lik this :
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00
AM
4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997
12:00:00 AM
5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997
12:00:00 AM
6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997
12:00:00 AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997
12:00:00 AM
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997
12:00:00 AM
5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997
12:00:00 AM
6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997
12:00:00 AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997
12:00:00 AM
test dateIssued dateIssued dateIssued
1 10/26/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
2 10/25/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
3 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM
4 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997
12:00:00 AM
5 11/1/1997 12:00:00 AM 11/1/1997 12:00:00 AM 11/1/1997
12:00:00 AM
6 10/24/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997
12:00:00 AM
7 10/26/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
8 10/25/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
9 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM 11/2/1997 12:00:00 AM
10 11/3/1997 12:00:00 AM 11/3/1997 12:00:00 AM 11/3/1997

12:00:00 AM

Regards,
Venu


Nov 16 '05 #3


Hi All
Iam Binding like this

<asp:TemplateCo lumn>
<HeaderTemplate >
dateIssued
</HeaderTemplate>
<ItemTemplate >
<asp:Label ID="Label2" Text='<%#
((DateTime)((Da taRow)Container .DataItem)["datecomple te"]).ToShortDateSt r
ing()%>' Runat=server />
</ItemTemplate>
</asp:TemplateCol umn>
Here ["datecomple te"] this is column name
I doing like this.
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'DataRow'
could not be found (are you missing a using directive or an assembly
reference?)

It's giving Error like this

Regards
venu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4
You have to include the System.Data namespace in the page with this

<% @Import namespace="Syst em.Data" %

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"karunakar rao" <ka***********@ stcroixsystems. com> wrote in message
news:un******** *****@TK2MSFTNG P11.phx.gbl...


Hi All
Iam Binding like this

<asp:TemplateCo lumn>
<HeaderTemplate >
dateIssued
</HeaderTemplate>
<ItemTemplate >
<asp:Label ID="Label2" Text='<%#
((DateTime)((Da taRow)Container .DataItem)["datecomple te"]).ToShortDateSt r
ing()%>' Runat=server />
</ItemTemplate>
</asp:TemplateCol umn>
Here ["datecomple te"] this is column name
I doing like this.
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'DataRow'
could not be found (are you missing a using directive or an assembly
reference?)

It's giving Error like this

Regards
venu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1480
by: Paolo Tardivel via DotNetMonster.com | last post by:
I have a databound datagrid containing template columns which allow editing of the values contained in the datagrid through the use of text boxes. One of the fields in the datagrid displays the time and date. When a row has been selected for editing I want to be able to click a button in the datagrid and update one of the text boxes with the current time and date. All the code for editing rows and getting the current time and date when...
3
4237
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the datatable feeding the datagrid control. Both are of the DateTime Type. How do I get the time field to display only the Time, and not the date, which is apparently the default.
1
1991
by: Adil Bohoudi | last post by:
Hi all, i'm using a datagrid to show somedata retrieved from an sql-server 2000. this datagrid contains two columns a startdate and an enddate column. i used a storedprocedure to get both dates. but when i use the following code: datagrid.datasource = selDates() datagrid.bind()
1
4345
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch the layout, some have child controls):
0
2086
by: NWx | last post by:
Hi, I have a Datagrid which display info from a database(SQLServer). Several column in SqlServer table are smalldatetime type, but I use them only for date How can I make Datagrid column to show only date, and not the time (which is 00:00:00 anyway)? Thank you
5
2042
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
4
5311
by: Reney | last post by:
I have a very weird problem in updating my datagrid. Please help me to solve it. The datagrid is tied to a dataset table with five columns. Three of them are primary key and the other two columns are the ones that are of interest. These two columns have "date" type values and shows short time (i.e. 11:39). The program updates the database if I change the values in these columns, or add a new record, or delete a record. But, if one of...
5
2710
by: M Skabialka | last post by:
I am creating my first Visual Studio project, an inventory database. I have created a form and used written directions to add data from a table to the form using table adapters, data sets, etc. I imported a table from an Access database which has some date fields. Many of these dates have never been filled in, so are nulls. If I look directly into the table data from Visual Studio it shows NULL. However, when I scroll from record to...
0
1091
by: Sreenath Rao Nellutla | last post by:
Hai All, 1. I need help regarding displaying Date in to DataGrid from SQL Server 2000 database in the required format. Sql Server data : smalldatetime DataGrid : Date (Only I want. But I am getting Date & Time).
0
9700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10546
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.