473,480 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Create 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='<%DataBinder.Eval(Container.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 2674
Hi,

You have to use the DateTime.ToShortDateString() 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.DataItem to the correct type , says DataRow and then
convert the column to DateTime and do the calling:

try this:
DataBinder.Eval(Container.DataItem,"dateissue.ToSh ortDateString() ")%

<%#
((DateTime)((DataRow)Container.DataItem)["RowName"]).ToShortDateString() %>

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**************@TK2MSFTNGP14.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='<%DataBinder.Eval(Container.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:TemplateColumn>
<HeaderTemplate>
dateIssued
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Label2" Text='<%#
((DateTime)((DataRow)Container.DataItem)["datecomplete"]).ToShortDateString(
)%>' Runat=server />
</ItemTemplate>
</asp:TemplateColumn>
Here ["datecomplete"] 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.machin AT dot.state.fl.us> wrote
in message news:eo**************@TK2MSFTNGP11.phx.gbl...
Hi,

You have to use the DateTime.ToShortDateString() 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.DataItem to the correct type , says DataRow and then
convert the column to DateTime and do the calling:

try this:
DataBinder.Eval(Container.DataItem,"dateissue.ToSh ortDateString() ")%

<%#
((DateTime)((DataRow)Container.DataItem)["RowName"]).ToShortDateString() %>
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**************@TK2MSFTNGP14.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='<%DataBinder.Eval(Container.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:TemplateColumn>
<HeaderTemplate>
dateIssued
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Label2" Text='<%#
((DateTime)((DataRow)Container.DataItem)["datecomplete"]).ToShortDateStr
ing()%>' Runat=server />
</ItemTemplate>
</asp:TemplateColumn>
Here ["datecomplete"] 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="System.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*************@TK2MSFTNGP11.phx.gbl...


Hi All
Iam Binding like this

<asp:TemplateColumn>
<HeaderTemplate>
dateIssued
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Label2" Text='<%#
((DateTime)((DataRow)Container.DataItem)["datecomplete"]).ToShortDateStr
ing()%>' Runat=server />
</ItemTemplate>
</asp:TemplateColumn>
Here ["datecomplete"] 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
1464
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...
3
4223
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...
1
1975
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...
1
4274
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...
0
2073
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...
5
2011
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...
4
5294
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...
5
2683
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. ...
0
1067
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...
0
7052
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,...
0
7092
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...
0
6981
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4790
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...
0
4488
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...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
565
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.