Set myDataColumn.DataType in Gridview
Posted on 2010-11-22
I was just wondeirng if anyone could explain how to change the DataType associated with a gridview in C#? The gridview is bound to a sqldatasource, however, one field that I want to format (Amount) as a currency is being automatically set as an integer column. So when I try to reformat the mydatarowview['Amount'] in the Rowcreated event I get a failure when I go to write the updated value as its now a string.
If there is a better way to go about this I would love to hear it as I am just coming over from years of PHP so ASP is still fairly new to me. I know how to go about this with SQL if need be but I really wanted to get it sorted out on my ASP page.