Some columns don't display in asp gridview

berniec

New Member
I have an asp gridview created on an aspx page and I add the BoundFields in the code behind (C#). Only the first two columns and the last column of the gridview actually display when I fun the page and I can't figure out why. Can anyone help??\[code\] <asp:GridView ID="GVTask" runat="server" HorizontalAlign="Center" DataKeyNames="taskID" OnRowCommand="GVTask_RowCommand" DataSourceID="SQLDatasourceGridview" AutoGenerateColumns="false"> <Columns> <asp:ButtonField ButtonType="Button" Text="View Task" CommandName="View" /> </Columns> <HeaderStyle BackColor="#FFFF30" BorderColor="Black" BorderStyle="Solid" Font-Names="Calibri" Font-Size="Medium" Font-Bold="false" ForeColor="#000000" /> <RowStyle BorderColor="Black" BorderStyle="Solid" Font-Names="Calibri" Font-Size="Medium" Font-Bold="false" ForeColor="#000000" /> </asp:GridView>\[/code\]Code Behind:\[code\]SQLDatasourceGridview.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SHAUNConnectionString"].ConnectionString;SQLDatasourceGridview.SelectCommand = SQLGridviewStg;SQLDatasourceGridview.Select(DataSourceSelectArguments.Empty); //Create all of the gridview colums (databoundfields) and initalise them //TaskID Field BoundField taskID = new BoundField(); taskID.DataField = "taskID"; taskID.HeaderText = "Task ID"; taskID.InsertVisible = false; taskID.ReadOnly = true; taskID.SortExpression = "taskID"; GVTask.Columns.Add(taskID); //TaskName Field BoundField taskName = new BoundField(); taskName.DataField = "taskName"; taskName.HeaderText = "Task Name"; taskName.SortExpression = "taskName"; GVTask.Columns.Add(taskName); //TaskType Field BoundField taskType = new BoundField(); taskType.DataField = "taskType"; taskType.HeaderText = "Task Type"; taskType.SortExpression = "taskType"; GVTask.Columns.Add(taskType); //TaskCategory Field BoundField taskCategory = new BoundField(); taskType.DataField = "taskCategory"; taskType.HeaderText = "Task Category"; taskType.SortExpression = "taskCategory"; GVTask.Columns.Add(taskCategory); //Task Sub category field BoundField taskSubCategory = new BoundField(); taskType.DataField = "taskSubCategory"; taskType.HeaderText = "Sub Category"; taskType.SortExpression = "taskSubCategory"; GVTask.Columns.Add(taskSubCategory); //Updated on field BoundField updatedOn = new BoundField(); taskType.DataField = "updatedOn"; taskType.HeaderText = "Last Update On"; taskType.SortExpression = "updatedOn"; GVTask.Columns.Add(updatedOn); //Last updated By field BoundField lastUpdateBy = new BoundField(); taskType.DataField = "lastUpdateBy"; taskType.HeaderText = "Last Update By"; taskType.SortExpression = "lastUpdateBy"; GVTask.Columns.Add(lastUpdateBy); //Created By Field BoundField createdBy = new BoundField(); taskType.DataField = "createdBy"; taskType.HeaderText = "Created By"; taskType.SortExpression = "createdBy"; GVTask.Columns.Add(createdBy); //Created on Field BoundField createdOn = new BoundField(); taskType.DataField = "createdOn"; taskType.HeaderText = "Created On"; taskType.SortExpression = "createdOn"; GVTask.Columns.Add(createdOn);\[/code\]
 
Top