broberts_23 Posted June 26, 2003 Posted June 26, 2003 I am trying to build a datagrid to display customer information at runtime. I am getting an error from the code below: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Windows.Forms; //Binding the data dSet = new DataSet(); myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); dGrid.Visible = true; dAdapter = new SqlDataAdapter(dQuery, myConnection); dAdapter.Fill(dSet, "Customer"); dGrid.DataSource = dSet.Tables["Customer"].DefaultView; dGrid.DataBind(); DataGridTableStyle tStyle = new DataGridTableStyle(); tStyle.MappingName = "Customer"; DataGridColumnStyle idCol = new DataGridBoolColumn(); idCol.HeaderText = "ID"; idCol.MappingName = "Current"; idCol.HeaderText = "ID"; idCol.ReadOnly = true; idCol.Width = 200; tStyle.GridColumnStyles.Add(idCol); dGrid.TableStyles.Add(tStyle); *** Iget an error here its says: 'System.Web.UI.Controls.DataGrid' does not contain a definition for 'TableStyles' can anyone shed some light on this? Quote
*Gurus* divil Posted June 26, 2003 *Gurus* Posted June 26, 2003 If you want the TableStyles property it sounds like you want the Windows Forms datagrid rather than the Web Forms datagrid you're trying to use at the moment. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.