|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagrid column formattingIs it possible to set the column widths of a datagrid?
This is driving me crazy, and I haven't found a solution yet. I'm pretty new to ASP.NET so there may be an easy way I'm just not aware of, however, I've Googled this until my eyes hurt and still haven't found a solution. Also, how would I set a few of my columns' format? (I have 3 date columns within the datagrid and I'd like to set the format to dd/mm/yyyy or something similar...) Any and all help would be appreciated! -Kelly Hi
You can use HeaderStyle-Width and ItemStyle-Width of column to set column width. To format date in a BoundColumn: DataFormatString="{0: MM/dd/yyyy}" To format date in a TemplateColumn: Text ='<%# DataBinder.Eval (Container.DataItem, "DateField", "{0: dd/MM/yyyy}")' HTH Elton Wang elton_w***@hotmail.com >-----Original Message----- yet. I'm pretty new>Is it possible to set the column widths of a datagrid? > >This is driving me crazy, and I haven't found a solution >to ASP.NET so there may be an easy way I'm just not aware of, however, I've>Googled this until my eyes hurt and still haven't found a have 3 date columnssolution. > >Also, how would I set a few of my columns' format? (I >within the datagrid and I'd like to set the format to dd/mm/yyyy orShow quoteHide quote >something similar...) > >Any and all help would be appreciated! > >-Kelly > > >. > Thank you! I'll fiddle with this a bit. :)
-Kelly Show quoteHide quote "Elton W" <anonym***@discussions.microsoft.com> wrote in message news:12ae01c5477d$c8450de0$a401280a@phx.gbl... > Hi > > You can use HeaderStyle-Width and ItemStyle-Width of > column to set column width. > > To format date in a BoundColumn: > DataFormatString="{0: MM/dd/yyyy}" > > To format date in a TemplateColumn: > Text ='<%# DataBinder.Eval > (Container.DataItem, "DateField", "{0: dd/MM/yyyy}")' > > HTH > > Elton Wang > elton_w***@hotmail.com > > > > >-----Original Message----- > >Is it possible to set the column widths of a datagrid? > > > >This is driving me crazy, and I haven't found a solution > yet. I'm pretty new > >to ASP.NET so there may be an easy way I'm just not aware > of, however, I've > >Googled this until my eyes hurt and still haven't found a > solution. > > > >Also, how would I set a few of my columns' format? (I > have 3 date columns > >within the datagrid and I'd like to set the format to > dd/mm/yyyy or > >something similar...) > > > >Any and all help would be appreciated! > > > >-Kelly > > > > > >. > >
Paging with Datagrid Control
Change/read value from control in EditItemTemplate how can I get the DataKeyField read row values from datagrid and populate in new datagrid values from connected Accessing data object on delete command. MessageBox not showing before Response.Redirect ItemDataBound Slow datagrid on postback how to use hyper columns in datagrid Error Message: FindControl requires that controls have unique IDs. |
|||||||||||||||||||||||