Hi
I want to format some columns of my DataGrid control.
Example, one of my fields of DataSet is a DATE field and in BD he is Ok, but
when I show him in datagrid he comes with hours too. I don´t want that.
2nd Example:
Field in BD:
DtSegm
17-02-2004
Note: When I save to DB I format Date to put like above
In DataGrid shows like this:
DtSegm
17-02-2004 10:30:45
How can I change that.
--
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca 10 2160
If you are using simple bound columns (using the Property builder) you may
asign the Data Format box in the property builder, or manually assign a
DataFormatString attribute in HTML view
If its a templated column, you may add the format as the third argument to
the Eval function, as in:
DataBinder.Eval(Container, "DataItem.DueDate", "d")
Regards
Jose.
"ruca" <ru***@iol.pt> escribió en el mensaje
news:eo**************@TK2MSFTNGP09.phx.gbl... Hi
I want to format some columns of my DataGrid control. Example, one of my fields of DataSet is a DATE field and in BD he is Ok,
but when I show him in datagrid he comes with hours too. I don´t want that.
2nd Example: Field in BD: DtSegm 17-02-2004 Note: When I save to DB I format Date to put like above
In DataGrid shows like this: DtSegm 17-02-2004 10:30:45
How can I change that.
--
Thank's (if you try to help me) Hope this help you (if I try to help you) ruca
Hi, ruca,
You can achive this by setting the DataFormatString property of the
BoundColumn approprietly: http://msdn.microsoft.com/library/en...tringtopic.asp
Set it to "dd-MM-yyyy". See the following link for more valid custom
DateTime format strings: http://msdn.microsoft.com/library/en...matstrings.asp
Greetings
Martin
"ruca" <ru***@iol.pt> wrote in message
news:eo**************@TK2MSFTNGP09.phx.gbl... Hi
I want to format some columns of my DataGrid control. Example, one of my fields of DataSet is a DATE field and in BD he is Ok,
but when I show him in datagrid he comes with hours too. I don´t want that.
2nd Example: Field in BD: DtSegm 17-02-2004 Note: When I save to DB I format Date to put like above
In DataGrid shows like this: DtSegm 17-02-2004 10:30:45
How can I change that.
--
Thank's (if you try to help me) Hope this help you (if I try to help you) ruca
What's wrong with this:
<asp:BoundColumn DataField="DtSgm" ReadOnly="True" HeaderText="DtSegmento"
DataFormatString="DtSgm.ToString('dd-MM-YYYY')"></asp:BoundColumn>
"Martin Dechev" <de*******@hotmail.com> escreveu na mensagem
news:Op**************@TK2MSFTNGP11.phx.gbl... Hi, ruca,
You can achive this by setting the DataFormatString property of the BoundColumn approprietly:
http://msdn.microsoft.com/library/en...webuiwebcontro
lsboundcolumnclassdataformatstringtopic.asp Set it to "dd-MM-yyyy". See the following link for more valid custom DateTime format strings:
http://msdn.microsoft.com/library/en...omdatetimeform
atstrings.asp Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl... Hi
I want to format some columns of my DataGrid control. Example, one of my fields of DataSet is a DATE field and in BD he is Ok, but when I show him in datagrid he comes with hours too. I don´t want that.
2nd Example: Field in BD: DtSegm 17-02-2004 Note: When I save to DB I format Date to put like above
In DataGrid shows like this: DtSegm 17-02-2004 10:30:45
How can I change that.
--
Thank's (if you try to help me) Hope this help you (if I try to help you) ruca
Hi, ruca,
You haven't read the article for the DataFormatString property, have you?
<asp:BoundColumn DataField="DtSgm" ReadOnly="True" HeaderText="DtSegmento"
DataFormatString="dd-MM-yyyy"/>
Greetings
Martin
"ruca" <ru***@iol.pt> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl... What's wrong with this:
<asp:BoundColumn DataField="DtSgm" ReadOnly="True" HeaderText="DtSegmento" DataFormatString="DtSgm.ToString('dd-MM-YYYY')"></asp:BoundColumn> "Martin Dechev" <de*******@hotmail.com> escreveu na mensagem news:Op**************@TK2MSFTNGP11.phx.gbl... Hi, ruca,
You can achive this by setting the DataFormatString property of the BoundColumn approprietly:
http://msdn.microsoft.com/library/en...webuiwebcontro lsboundcolumnclassdataformatstringtopic.asp Set it to "dd-MM-yyyy". See the following link for more valid custom DateTime format strings:
http://msdn.microsoft.com/library/en...omdatetimeform atstrings.asp Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl... Hi
I want to format some columns of my DataGrid control. Example, one of my fields of DataSet is a DATE field and in BD he is
Ok, but when I show him in datagrid he comes with hours too. I don´t want
that. 2nd Example: Field in BD: DtSegm 17-02-2004 Note: When I save to DB I format Date to put like above
In DataGrid shows like this: DtSegm 17-02-2004 10:30:45
How can I change that.
--
Thank's (if you try to help me) Hope this help you (if I try to help you) ruca
How can I format a Field that I have to calculate something.
Like this:
Field1 in DB is a Double
Field1 = 0.11
And I want to appear: 0.11 * 100 = 11
Thanks
"Martin Dechev" <de*******@hotmail.com> escreveu na mensagem
news:Op**************@TK2MSFTNGP11.phx.gbl... Hi, ruca,
You can achive this by setting the DataFormatString property of the BoundColumn approprietly:
http://msdn.microsoft.com/library/en...webuiwebcontro
lsboundcolumnclassdataformatstringtopic.asp Set it to "dd-MM-yyyy". See the following link for more valid custom DateTime format strings:
http://msdn.microsoft.com/library/en...omdatetimeform
atstrings.asp Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl... Hi
I want to format some columns of my DataGrid control. Example, one of my fields of DataSet is a DATE field and in BD he is Ok, but when I show him in datagrid he comes with hours too. I don´t want that.
2nd Example: Field in BD: DtSegm 17-02-2004 Note: When I save to DB I format Date to put like above
In DataGrid shows like this: DtSegm 17-02-2004 10:30:45
How can I change that.
--
Thank's (if you try to help me) Hope this help you (if I try to help you) ruca
I've got working now. I already understand how can I format string's in the
way that I want. Thank's Martin.
But now I have another question:
How can I format a Field that I have to calculate something.
Like this:
Field1 in DB is a Double
Field1 = 0.11
And I want to appear: 0.11 * 100 = 11
Thanks
"Martin Dechev" <de*******@hotmail.com> escreveu na mensagem
news:#y**************@TK2MSFTNGP09.phx.gbl... Hi, ruca,
You haven't read the article for the DataFormatString property, have you?
<asp:BoundColumn DataField="DtSgm" ReadOnly="True" HeaderText="DtSegmento" DataFormatString="dd-MM-yyyy"/>
Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eP**************@TK2MSFTNGP09.phx.gbl... What's wrong with this:
<asp:BoundColumn DataField="DtSgm" ReadOnly="True"
HeaderText="DtSegmento" DataFormatString="DtSgm.ToString('dd-MM-YYYY')"></asp:BoundColumn> "Martin Dechev" <de*******@hotmail.com> escreveu na mensagem news:Op**************@TK2MSFTNGP11.phx.gbl... Hi, ruca,
You can achive this by setting the DataFormatString property of the BoundColumn approprietly:
http://msdn.microsoft.com/library/en...webuiwebcontro lsboundcolumnclassdataformatstringtopic.asp Set it to "dd-MM-yyyy". See the following link for more valid custom DateTime format strings:
http://msdn.microsoft.com/library/en...omdatetimeform atstrings.asp Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl... > Hi > > I want to format some columns of my DataGrid control. > Example, one of my fields of DataSet is a DATE field and in BD he is
Ok, but > when I show him in datagrid he comes with hours too. I don´t want that. > > 2nd Example: > Field in BD: > DtSegm > 17-02-2004 > Note: When I save to DB I format Date to put like above > > In DataGrid shows like this: > DtSegm > 17-02-2004 10:30:45 > > How can I change that. > > > -- > > Thank's (if you try to help me) > Hope this help you (if I try to help you) > ruca > >
It should be "{0:dd-MM-yyyy}" in this case, sorry for the mistake.
Hope this helps
Martin
"Martin Dechev" <de*******@hotmail.com> wrote in message
news:#y**************@TK2MSFTNGP09.phx.gbl... Hi, ruca,
You haven't read the article for the DataFormatString property, have you?
<asp:BoundColumn DataField="DtSgm" ReadOnly="True" HeaderText="DtSegmento" DataFormatString="dd-MM-yyyy"/>
Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eP**************@TK2MSFTNGP09.phx.gbl... What's wrong with this:
<asp:BoundColumn DataField="DtSgm" ReadOnly="True"
HeaderText="DtSegmento" DataFormatString="DtSgm.ToString('dd-MM-YYYY')"></asp:BoundColumn> "Martin Dechev" <de*******@hotmail.com> escreveu na mensagem news:Op**************@TK2MSFTNGP11.phx.gbl... Hi, ruca,
You can achive this by setting the DataFormatString property of the BoundColumn approprietly:
http://msdn.microsoft.com/library/en...webuiwebcontro lsboundcolumnclassdataformatstringtopic.asp Set it to "dd-MM-yyyy". See the following link for more valid custom DateTime format strings:
http://msdn.microsoft.com/library/en...omdatetimeform atstrings.asp Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl... > Hi > > I want to format some columns of my DataGrid control. > Example, one of my fields of DataSet is a DATE field and in BD he is
Ok, but > when I show him in datagrid he comes with hours too. I don´t want that. > > 2nd Example: > Field in BD: > DtSegm > 17-02-2004 > Note: When I save to DB I format Date to put like above > > In DataGrid shows like this: > DtSegm > 17-02-2004 10:30:45 > > How can I change that. > > > -- > > Thank's (if you try to help me) > Hope this help you (if I try to help you) > ruca > >
1. In the grid's Property Builder page, clear the "Data Format" field and
then convert your "bound column" into a "templated column" using the
provided link
2. Edit the HTML and replace the binding expression as follows (assuming
DataItem.Qty is an integer)
Instead of
<%# DataBinder.Eval(Container, "DataItem.Qty") %>
use
<%# (((int)DataBinder.Eval(Container,
"DataItem.Qty"))*100).ToString("d9") %>
Regards
Jose.
"ruca" <ru***@iol.pt> escribió en el mensaje
news:O8**************@TK2MSFTNGP09.phx.gbl... How can I format a Field that I have to calculate something. Like this: Field1 in DB is a Double Field1 = 0.11
And I want to appear: 0.11 * 100 = 11
Thanks
"Martin Dechev" <de*******@hotmail.com> escreveu na mensagem news:Op**************@TK2MSFTNGP11.phx.gbl... Hi, ruca,
You can achive this by setting the DataFormatString property of the BoundColumn approprietly:
http://msdn.microsoft.com/library/en...webuiwebcontro lsboundcolumnclassdataformatstringtopic.asp Set it to "dd-MM-yyyy". See the following link for more valid custom DateTime format strings:
http://msdn.microsoft.com/library/en...omdatetimeform atstrings.asp Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl... Hi
I want to format some columns of my DataGrid control. Example, one of my fields of DataSet is a DATE field and in BD he is
Ok, but when I show him in datagrid he comes with hours too. I don´t want
that. 2nd Example: Field in BD: DtSegm 17-02-2004 Note: When I save to DB I format Date to put like above
In DataGrid shows like this: DtSegm 17-02-2004 10:30:45
How can I change that.
--
Thank's (if you try to help me) Hope this help you (if I try to help you) ruca
<%# (((int)DataBinder.Eval(Container,"DataItem.Qty"))* 100).ToString("d9") %>
The part of ToString("d9") doesn't work.
I have to set this value: DataBinder.Eval(Container,"DataItem.Qty"))*100)
into a double of 2 decimal places
How?
"Jose Marcenaro" <jo***@nospam.da-vinci.com.ar> escreveu na mensagem
news:OP**************@TK2MSFTNGP09.phx.gbl... 1. In the grid's Property Builder page, clear the "Data Format" field and then convert your "bound column" into a "templated column" using the provided link
2. Edit the HTML and replace the binding expression as follows (assuming DataItem.Qty is an integer)
Instead of <%# DataBinder.Eval(Container, "DataItem.Qty") %> use <%# (((int)DataBinder.Eval(Container, "DataItem.Qty"))*100).ToString("d9") %>
Regards Jose.
"ruca" <ru***@iol.pt> escribió en el mensaje news:O8**************@TK2MSFTNGP09.phx.gbl... How can I format a Field that I have to calculate something. Like this: Field1 in DB is a Double Field1 = 0.11
And I want to appear: 0.11 * 100 = 11
Thanks
"Martin Dechev" <de*******@hotmail.com> escreveu na mensagem news:Op**************@TK2MSFTNGP11.phx.gbl... Hi, ruca,
You can achive this by setting the DataFormatString property of the BoundColumn approprietly:
http://msdn.microsoft.com/library/en...webuiwebcontro lsboundcolumnclassdataformatstringtopic.asp Set it to "dd-MM-yyyy". See the following link for more valid custom DateTime format strings:
http://msdn.microsoft.com/library/en...omdatetimeform atstrings.asp Greetings Martin "ruca" <ru***@iol.pt> wrote in message news:eo**************@TK2MSFTNGP09.phx.gbl... > Hi > > I want to format some columns of my DataGrid control. > Example, one of my fields of DataSet is a DATE field and in BD he is Ok, but > when I show him in datagrid he comes with hours too. I don´t want that. > > 2nd Example: > Field in BD: > DtSegm > 17-02-2004 > Note: When I save to DB I format Date to put like above > > In DataGrid shows like this: > DtSegm > 17-02-2004 10:30:45 > > How can I change that. > > > -- > > Thank's (if you try to help me) > Hope this help you (if I try to help you) > ruca > >
Use either .ToString("#.00")
or .ToString("#,###.00") if you want thousands separators
"ruca" <ru***@iol.pt> escribió en el mensaje
news:eJ****************@TK2MSFTNGP12.phx.gbl... <%# (((int)DataBinder.Eval(Container,"DataItem.Qty"))* 100).ToString("d9")
%> The part of ToString("d9") doesn't work. I have to set this value: DataBinder.Eval(Container,"DataItem.Qty"))*100) into a double of 2 decimal places
How? "Jose Marcenaro" <jo***@nospam.da-vinci.com.ar> escreveu na mensagem news:OP**************@TK2MSFTNGP09.phx.gbl... 1. In the grid's Property Builder page, clear the "Data Format" field
and then convert your "bound column" into a "templated column" using the provided link
2. Edit the HTML and replace the binding expression as follows (assuming DataItem.Qty is an integer)
Instead of <%# DataBinder.Eval(Container, "DataItem.Qty") %> use <%# (((int)DataBinder.Eval(Container, "DataItem.Qty"))*100).ToString("d9") %>
Regards Jose.
"ruca" <ru***@iol.pt> escribió en el mensaje news:O8**************@TK2MSFTNGP09.phx.gbl... How can I format a Field that I have to calculate something. Like this: Field1 in DB is a Double Field1 = 0.11
And I want to appear: 0.11 * 100 = 11
Thanks
"Martin Dechev" <de*******@hotmail.com> escreveu na mensagem news:Op**************@TK2MSFTNGP11.phx.gbl... > Hi, ruca, > > You can achive this by setting the DataFormatString property of the > BoundColumn approprietly: > >
http://msdn.microsoft.com/library/en...webuiwebcontro lsboundcolumnclassdataformatstringtopic.asp > > Set it to "dd-MM-yyyy". See the following link for more valid custom > DateTime format strings: > > http://msdn.microsoft.com/library/en...omdatetimeform atstrings.asp > > Greetings > Martin > "ruca" <ru***@iol.pt> wrote in message > news:eo**************@TK2MSFTNGP09.phx.gbl... > > Hi > > > > I want to format some columns of my DataGrid control. > > Example, one of my fields of DataSet is a DATE field and in BD he
is Ok, > but > > when I show him in datagrid he comes with hours too. I don´t want that. > > > > 2nd Example: > > Field in BD: > > DtSegm > > 17-02-2004 > > Note: When I save to DB I format Date to put like above > > > > In DataGrid shows like this: > > DtSegm > > 17-02-2004 10:30:45 > > > > How can I change that. > > > > > > -- > > > > Thank's (if you try to help me) > > Hope this help you (if I try to help you) > > ruca > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tamlin |
last post by:
Hi all,
I'm getting a bug with the datagrid object.
I've created one from scratch, bound it to a dataview with 2 int32
columns and formatted the output as currency.
I've found that when you...
|
by: Funbeat |
last post by:
Hi everybody,
A very strange problem with WebControls :
A Datagrid in an ASp.net application;
Bound with a dataset through ado.net;
The updatable columns are dynamically created;
When I try...
|
by: J.B |
last post by:
I have a datagrid that will display different datasets, (it runs
different sprocs based on a value in the querystring) but it will
always return 6 columns. The 5th and 6th columns are always Date...
|
by: Hutty |
last post by:
I've looked around and have yet to find anything that would answer my
question regarding formating a column in a datagrid. My grid looks like
this as far as data"
AMHQCON|51300.01|-3147
The...
|
by: yer darn tootin |
last post by:
Does anyone know the sort expression for a column that's data has been
returned in the format, eg '07 Jul 05'??
The sort expression {..:"dd mmm yy"} doesn't work ( if the column was
returned as...
|
by: charliewest |
last post by:
I am adding boundColumns to my DataGrid via code-behind using the following
code:
BoundColumn bc = new BoundColumn();
bc.HeaderText = "Users";
bc.DataField = "vUserId";
bc.SortExpression =...
|
by: Narshe |
last post by:
I have a datagrid that gets bound, and on itemdatabound, there is no
data. If I look at datagrid.items, there is no data in the items
either. When the page is displayed, the datagrid has all the...
|
by: =?Utf-8?B?bmt3?= |
last post by:
I have a gridview which need to filled by various data according to user's
action. I want to format the dynamical displayed data. For example the number
should be right aligned, datetime column...
|
by: RN1 |
last post by:
A DataGrid displays records from a database. The Datagrid displays 13
columns (excluding the EditCommandColumn). In some of the rows, only
the first 8 cells will show data & the last 5 will be...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
| |