By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,064 Members | 1,445 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,064 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a


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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.