Datagrids and Regular Expressions
-
Hi All, I am using a datagrid on a page to show some data from my sql database. I just need to know if you can use a regular expression to change a 1 into 'Male'? If not how would I change something like that. My SQL database is returning integers and I want to display them nicely. Thanks, Gavin
-
Hi All, I am using a datagrid on a page to show some data from my sql database. I just need to know if you can use a regular expression to change a 1 into 'Male'? If not how would I change something like that. My SQL database is returning integers and I want to display them nicely. Thanks, Gavin
Use a template column such as:
public string MyFormat() { // Do what you need here return MyFormatedString; } <asp:DataGrid .... <ItemTemplate> <% =MyFormat() %>
Should be enough for you to fill in the blanks. Search MSDN for ItemTemplate or look at Dino Esposito's recent three part MSDN Mag series on build a Data Navigator control. -
Hi All, I am using a datagrid on a page to show some data from my sql database. I just need to know if you can use a regular expression to change a 1 into 'Male'? If not how would I change something like that. My SQL database is returning integers and I want to display them nicely. Thanks, Gavin
You can do that with an SQL statement assume gender is the name of your column: Select decode(gender, '0', 'Female', '1', 'Male') as gender from sometable search for "sql decode" on google Todd Smith