Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: DataGrid


Message #1 by "Samuel Engelman" <samuel_engelman@p...> on Wed, 18 Jul 2001 12:58:39 -0400
I have a bound datagrid and I want to format a column as a date. What would I

have to put in to the dataformat string field to get the following format:

mm/dd/yyyy



Thanks





Message #2 by "pardo" <mpredajniansky@s...> on Tue, 24 Jul 2001 06:59:25
You cen modify format column format by opening property dialog COLUMNS. 

Select column and fill field: Data Formating Expression

Value for date is {0:MM/dd/yyyy}



You can format column in the code, too. You must do it before you bind the 

DataGrid.



  System.Web.UI.WebControls.BoundColumn BC;

  BC=(System.Web.UI.WebControls.BoundColumn)DataGrid1.Columns[i];

  BC.DataFormatString="{0:dd.MM.yyyy}";

  DataGrid1.DataBind();





> I have a bound datagrid and I want to format a column as a date. What 

would I

> have to put in to the dataformat string field to get the following 

format:

> mm/dd/yyyy

> 

> Thanks

> 

> 

Message #3 by "Samuel Engelman" <samuel_engelman@p...> on Tue, 24 Jul 2001 11:03:51 -0400
Thanks pardo, It worked.



I have the following case:



     A column with an 8 byte string such as abcdefgh. I want to display

 it like

this: abc-defgh. is there any way to do this with the dataformat proper

ty?









|--------+--------------------------------->

|        |   "pardo"                       |

|        |   <mpredajniansky@s...>    |

|        |                                 |

|        |                                 |

|        |   Tuesday July 24, 2001 02:59 AM|

|        |   Please respond to "ASP+"      |

|        |                                 |

|--------+--------------------------------->

  >--------------------------------------------------------------------

--------|

  |                                                                    

        |

  |      To:                                  "ASP+" <aspx@p...

>       |

  |      cc:                                                           

        |

  |      Subject: [aspx] Re: DataGrid                                  

        |

  >--------------------------------------------------------------------

--------|









You cen modify format column format by opening property dialog COLUMNS.



Select column and fill field: Data Formating Expression

Value for date is {0:MM/dd/yyyy}



You can format column in the code, too. You must do it before you bind 

the

DataGrid.



  System.Web.UI.WebControls.BoundColumn BC;

  BC=3D(System.Web.UI.WebControls.BoundColumn)DataGrid1.Columns[i];

  BC.DataFormatString=3D"{0:dd.MM.yyyy}";

  DataGrid1.DataBind();





> I have a bound datagrid and I want to format a column as a date. What



would I

> have to put in to the dataformat string field to get the following

format:

> mm/dd/yyyy

>

> Thanks

>

>






  Return to Index