472,351 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

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 2557
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
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. ...
3
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...
1
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...
1
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...
0
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...
5
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....
4
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...
5
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...
0
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 :...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

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.