c# - How can I change the way my data shows up on GridView after I pulled it from SQL DB -


i pull data out of database , put in dataset through sqladapted , databind it.

my question how can change way data presented in table?

example: should have 2 digits after decimal , should have 3 etc. example: should right justified whereas should centered?

when build gridview, can assign items <asp:boundfields>, instead of using "autogeneratecolumns". gives more control, example:

<asp:boundfield datafield="datelastcontacted" headertext="contacted" sortexpression="datelastcontacted" itemstyle-cssclass="resultscell" headerstyle-cssclass="resultsheader" itemstyle-horizontalalign="center" dataformatstring="{0:dd mmm yyy}" nulldisplaytext="n/a" />

you can use itemstyle-horizontalalign="center" alignment, , use dataformatstring="{0:n2}" specify decimals, see here:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx

hth


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -