hendridm
asked on
Applying formatting to bound datagrid column values
I have a datagrid that is bound to a SQL data source. The grid displays just fine in the browser. However, I'm pulling from a DB2 database from an AS/400, and all the data values are capitalized. Is there a way to format a bound column as mixed case/propercase? Example: 'Hello World' instead of 'HELLO WORLD'
A couple of ideas I thought of without luck:
1. Format on the database side - unfortunately, DB2 doesn't appear to have a "ProperCase"-type function.
2. Use a function to format the column value - I created a function to convert a string to "proper case", however, I don't know how to use it in the datagrid definition.
3. Use the 'DataFormatString' parameter on the column - I don't think this is capable of doing what I want - looks like it's mainly for dates, numbers, and currency.
Ideas? Here is a snippet of my DataGrid def:
<ASP:DataGrid id="dgResults" runat="server">
<Columns>
<asp:BoundColumn HeaderText="Key" DataField="pmkey" DataFormatString="{0:##-#- ####-##}" />
<asp:BoundColumn HeaderText="First Name" DataField="pmfirst" />
<asp:BoundColumn HeaderText="Last Name" DataField="pmlast" />
<asp:BoundColumn HeaderText="Address" DataField="pmaddr" />
<asp:ButtonColumn HeaderText="Photo" />
</Columns>
</ASP:DataGrid>
I'd like the 'pmfirst' and 'pmlast' column values to be displayed in "proper"/mixed case.
A couple of ideas I thought of without luck:
1. Format on the database side - unfortunately, DB2 doesn't appear to have a "ProperCase"-type function.
2. Use a function to format the column value - I created a function to convert a string to "proper case", however, I don't know how to use it in the datagrid definition.
3. Use the 'DataFormatString' parameter on the column - I don't think this is capable of doing what I want - looks like it's mainly for dates, numbers, and currency.
Ideas? Here is a snippet of my DataGrid def:
<ASP:DataGrid id="dgResults" runat="server">
<Columns>
<asp:BoundColumn HeaderText="Key" DataField="pmkey" DataFormatString="{0:##-#-
<asp:BoundColumn HeaderText="First Name" DataField="pmfirst" />
<asp:BoundColumn HeaderText="Last Name" DataField="pmlast" />
<asp:BoundColumn HeaderText="Address" DataField="pmaddr" />
<asp:ButtonColumn HeaderText="Photo" />
</Columns>
</ASP:DataGrid>
I'd like the 'pmfirst' and 'pmlast' column values to be displayed in "proper"/mixed case.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.