C
Cindy Lee
I get my data from a basic xml file and make a datatable, and then bind it
to the gridview. I think it's not sorting or dataformatString correctly
because it thinks it's a string and not a number. Is there a way to tell
the gridview the value is a int?
This is how I bind the data:
DataSet aDataSet = new DataSet();
aDataSet.ReadXml(new StringReader(xmlString));
DataTable table = aDataSet.Tables[0];
GridView1.DataSource = table;
GridView1.AllowSorting = true;
GridView1.DataBind();
Here is a bound field:
<asp:BoundField DataField="percentage" HeaderText="%"
SortExpression="percentage" HtmlEncode="False" DataFormatString="{02}"
ReadOnly="True" />
All my value colums are sorted alphabetical
to the gridview. I think it's not sorting or dataformatString correctly
because it thinks it's a string and not a number. Is there a way to tell
the gridview the value is a int?
This is how I bind the data:
DataSet aDataSet = new DataSet();
aDataSet.ReadXml(new StringReader(xmlString));
DataTable table = aDataSet.Tables[0];
GridView1.DataSource = table;
GridView1.AllowSorting = true;
GridView1.DataBind();
Here is a bound field:
<asp:BoundField DataField="percentage" HeaderText="%"
SortExpression="percentage" HtmlEncode="False" DataFormatString="{02}"
ReadOnly="True" />
All my value colums are sorted alphabetical