Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting a TemplateColumn

Status
Not open for further replies.

tmryan

Programmer
Dec 22, 2000
73
US
I figured out how to do this with a BoundColumn - but not a TemplateColumn. I have a column in a datagrid whose values I want to be formatted as DataFormatString="{0:N0}" - like I would with a BoundColumn. I don't see such an option for a TemplateColumn. Can this be done? My TemplateColumn is defined as follows:

<asp:TemplateColumn FooterStyle-Font-Bold=&quot;True&quot; FooterStyle-HorizontalAlign=&quot;Right&quot; HeaderStyle-CssClass=&quot;mdcaptext&quot; HeaderStyle-Font-Bold=True ItemStyle-BackColor=#d5e0f1 HeaderText=&quot;CYTD Actual&quot; ItemStyle-HorizontalAlign=&quot;Right&quot; HeaderStyle-Font-Size=&quot;8&quot; HeaderStyle-HorizontalAlign=Center>
<ItemTemplate>
<asp:Label id=&quot;lblCYTDActual&quot; runat=&quot;server&quot; Font-Bold=<%# findBold(DataBinder.Eval(Container.DataItem, &quot;total_info&quot;).ToString())%> Text='<%# DataBinder.Eval(Container.DataItem, &quot;cytd_actual&quot;) %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

(Sorry about the wrapping text).

Thanks
Tim Ryan

Tim Ryan
PROGRESS Developer
 
Tim: One method would be to create a Public function in the code behind: See thread855-692669
 
That did the trick.

Thanks!

Tim Ryan
PROGRESS Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top