Don,
How are you binding it manually? I have the following example that uses the
<asp:BoundColumn DataField="Name 1" /> and it binds fine to a datatable
that has a field named "Name 1".
-- Begin Example --
<%@ Page %>
<%@ import Namespace="System.Data" %>
<script runat="server">
void Page_Load()
{
if(!IsPostBack) {
DataTable tbl = new DataTable();
tbl.Columns.Add("Name 1", typeof(string));
tbl.Columns.Add("regnum", typeof(string));
tbl.Columns.Add("birthdate", typeof(DateTime));
DataRow dr;
dr = tbl.NewRow();
dr["Name 1"] = "Ben Miller";
dr["regnum"] = "Description 1";
dr["birthdate"] = new DateTime(2002,1,1);
tbl.Rows.Add(dr);
dr = tbl.NewRow();
dr["Name 1"] = "George Miller";
dr["regnum"] = "Description 2";
dr["birthdate"] = new DateTime(2002,2,1);
tbl.Rows.Add(dr);
bulldatagrid.DataSource = tbl;
bulldatagrid.DataBind();
}
}
</script>
<html>
<body>
<form runat="server">
<asp:datagrid id="bulldatagrid" runat="server" Width="800px"
AlternatingItemStyle-BackColor="#eeeeee" PageSize="10"
PagerStyle-Mode="Numericpages" CellPadding="2" GridLines="Both"
HeaderStyle-BackColor="silver" HeaderStyle-HorizontalAlign="center"
FooterStyle-BackColor="silver" ShowFooter="True" AllowSorting="True"
OnSortCommand="SortRows" AllowPaging="True"
PagerStyle-HorizontalAlign="Right" OnPageIndexChanged="changegridpage"
AutoGenerateColumns="False" Font-Name="tahoma" Font-Size="8pt"
OnItemCommand="gridcommand">
<AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
<HeaderStyle HorizontalAlign="Center"
BackColor="#AAAADD"></HeaderStyle>
<FooterStyle BackColor="#AAAADD"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="regnum" SortExpression="regnum"
HeaderText="Regnum"></asp:BoundColumn>
<asp:BoundColumn DataField="name 1" SortExpression="name"
HeaderText="Name"></asp:BoundColumn>
<asp:BoundColumn DataField="birthdate" SortExpression="birthdate"
HeaderText="Birth Date" DataFormatString="{0:d}"></asp:BoundColumn>
<asp:buttoncolumn commandname="view1" text="View" runat="server"
ButtonType="LinkButton"></asp:buttoncolumn>
<asp:buttoncolumn commandname="view2" text="View" runat="server"
ButtonType="PushButton"></asp:buttoncolumn>
</Columns>
<PagerStyle HorizontalAlign="Right" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
</form>
</body>
</html>
-- End Code --
Ben Miller
This post is provided "AS IS" and expresses no warranties or liabilities.