Hi,
I'm binding a DataRead (obtained from a mssql SP)to a DataGrid, and one
of the values is a date...
The problem is that date is shown as dd/mm/yyyy hh:mm:ss and I would
like to format it as dd/mm/yyyy...
How can I do it ?
I have seen some code using ItemDataBound event, but I can't manage to
apply them...
TIA 5 1163
OK, keep trying to apply ItemDataBound event. What is the problem? To format
date use DateTime.ToString (formatString) method with format string
"dd/mm/yyy".
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message
news:u4**************@TK2MSFTNGP14.phx.gbl... Hi,
I'm binding a DataRead (obtained from a mssql SP)to a DataGrid, and one of the values is a date...
The problem is that date is shown as dd/mm/yyyy hh:mm:ss and I would like to format it as dd/mm/yyyy...
How can I do it ?
I have seen some code using ItemDataBound event, but I can't manage to apply them...
TIA
My problem is that I can't find a sample for to retreive cell value and
reasign to it a new value...
Eliyahu Goldin wrote: OK, keep trying to apply ItemDataBound event. What is the problem? To format date use DateTime.ToString (formatString) method with format string "dd/mm/yyy".
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message news:u4**************@TK2MSFTNGP14.phx.gbl...
Hi,
I'm binding a DataRead (obtained from a mssql SP)to a DataGrid, and one of the values is a date...
The problem is that date is shown as dd/mm/yyyy hh:mm:ss and I would like to format it as dd/mm/yyyy...
How can I do it ?
I have seen some code using ItemDataBound event, but I can't manage to apply them...
TIA
OK, suppose your column 0 contains the date you want to convert.
private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Cells[0].Text =
System.Convert.ToDateTime(e.Item.Cells[0].Text ).ToString("dd/mm/yyyy");
}
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message
news:Oi**************@TK2MSFTNGP11.phx.gbl... My problem is that I can't find a sample for to retreive cell value and reasign to it a new value...
Eliyahu Goldin wrote:
OK, keep trying to apply ItemDataBound event. What is the problem? To
format date use DateTime.ToString (formatString) method with format string "dd/mm/yyy".
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message news:u4**************@TK2MSFTNGP14.phx.gbl...
Hi,
I'm binding a DataRead (obtained from a mssql SP)to a DataGrid, and one of the values is a date...
The problem is that date is shown as dd/mm/yyyy hh:mm:ss and I would like to format it as dd/mm/yyyy...
How can I do it ?
I have seen some code using ItemDataBound event, but I can't manage to apply them...
TIA
OK, that's the code I need... This code give me error with datetime
converstion, but that's another story...
Thanx
Eliyahu Goldin wrote: OK, suppose your column 0 contains the date you want to convert.
private void dgSelection_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { ListItemType itemType = e.Item.ItemType; if ((itemType == ListItemType.Pager) || (itemType == ListItemType.Header) || (itemType == ListItemType.Footer)) { return; } e.Item.Cells[0].Text = System.Convert.ToDateTime(e.Item.Cells[0].Text ).ToString("dd/mm/yyyy"); }
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message news:Oi**************@TK2MSFTNGP11.phx.gbl...
My problem is that I can't find a sample for to retreive cell value and reasign to it a new value...
Eliyahu Goldin wrote:
OK, keep trying to apply ItemDataBound event. What is the problem? To format date use DateTime.ToString (formatString) method with format string "dd/mm/yyy".
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message news:u4**************@TK2MSFTNGP14.phx.gbl...
Hi,
I'm binding a DataRead (obtained from a mssql SP)to a DataGrid, and one of the values is a date...
The problem is that date is shown as dd/mm/yyyy hh:mm:ss and I would like to format it as dd/mm/yyyy...
How can I do it ?
I have seen some code using ItemDataBound event, but I can't manage to apply them...
TIA
Check out "Formatting Dates, Currency, and Other Data" section in this
article, http://msdn.microsoft.com/library/de...verControl.asp
--
-Saravana http://dotnetjunkies.com/WebLog/saravana/ www.ExtremeExperts.com
"Franck Diastein" <fd*******@euskaltel.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... OK, that's the code I need... This code give me error with datetime converstion, but that's another story...
Thanx
Eliyahu Goldin wrote:
OK, suppose your column 0 contains the date you want to convert.
private void dgSelection_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { ListItemType itemType = e.Item.ItemType; if ((itemType == ListItemType.Pager) || (itemType == ListItemType.Header) || (itemType == ListItemType.Footer)) { return; } e.Item.Cells[0].Text = System.Convert.ToDateTime(e.Item.Cells[0].Text ).ToString("dd/mm/yyyy"); }
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message news:Oi**************@TK2MSFTNGP11.phx.gbl...
My problem is that I can't find a sample for to retreive cell value and reasign to it a new value...
Eliyahu Goldin wrote:
OK, keep trying to apply ItemDataBound event. What is the problem? To
format
date use DateTime.ToString (formatString) method with format string "dd/mm/yyy".
Eliyahu
"Franck Diastein" <fd*******@euskaltel.net> wrote in message news:u4**************@TK2MSFTNGP14.phx.gbl...
>Hi, > >I'm binding a DataRead (obtained from a mssql SP)to a DataGrid, and
one>of the values is a date... > >The problem is that date is shown as dd/mm/yyyy hh:mm:ss and I would >like to format it as dd/mm/yyyy... > >How can I do it ? > >I have seen some code using ItemDataBound event, but I can't manage to >apply them... > >TIA
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Shivang |
last post by:
Hello Everybody,
I am using Datagrid in VB.net. I don't want the auto
generation of rows in the datagrid (last row shouldnt be
the new row with empty values)..in addition to this the
datagrid...
|
by: Tom Hughes |
last post by:
I want to change one field of all selected rows to a provided value.
Problem 1
I am using the Binding Manager Base to bind the datagrid to the
appropriate dataTable as recommended by KB817247....
|
by: Jeff |
last post by:
IDE: VS 2003 :NET
OS: XP Pro
My app have a form with a tab-control on it. The tab-control have 2
tabpages. One of the tabpages displays a datagrid, and the other tabpage
displays details (order...
|
by: Steve B. |
last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's
reflect the contents of the grid cells.
Sorting of columns (both thru VS and programmatically) work fine except,
when the...
|
by: Dave |
last post by:
Tried posting in the Winform Forum without much luck, so posting here...
After inserting a new data row to a DataTable that is bound to a
datagrid, I am unable to change data in a row that is...
|
by: Alpha |
last post by:
I have several textboxes that I need to chang the text when the selection row
is changed in a datagrid. I have the following code. This textbox displayes
the initial selection but when I click on...
|
by: vinayak |
last post by:
Hi
I am displaying data in Datagrid in ASP.NET with
Edit/Update functionality for each row. On the same page I
have 2 Button controls which submits the request to
server. These button controls...
|
by: Brad Shook |
last post by:
I am trying to bind one column of a datagrid to a seperate textbox and
the rest of the fields to a datagrid. the comments are too large to
fit in a datagrid so I created a textbox below the...
|
by: A_PK |
last post by:
I have problem databinding the DataGrid with DataView/DataSet after the
filter...
I create the following proceudre in order for user to filter as many as they
want, but the following code is only...
|
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= |
last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor
information and the details loads the documents for that vendor in a
datagrid. Everything is working fine until I click...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |