Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible to determine if the dt has rows?
Message
From
12/05/2009 12:19:29
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01399235
Message ID:
01399419
Views:
50
This message has been marked as a message which has helped to the initial question of the thread.
Hmmm, I don't see anything out of the ordinary but I'm a bit out of practice with windows forms. Are you 100% sure there's a value being loaded to that field in the DS? Maybe set the debugger on the data load and manually inspect the DS contents.

>The first, ItemNo. Also I set the grdOrderItems.Visible = false in the Activate method of the form, but it still shows up.
>
>>What field name is not showing up?
>>
>>>For some unknown reason the first column is not showing up in the grid:
>>>
>>>
>>> private void FormatOrderItemsGrid(OrderDetailsDS.OrderDetailsDataTable dt)
>>>        {
>>>            if (_gridStyleItem == null)
>>>            {
>>>                _gridStyleItem = new DataGridTableStyle();
>>>                this.grdOrderItems.TableStyles.Add(_gridStyleItem);
>>>                this.grdOrderItems.TableStyles[0].MappingName = dt.TableName;
>>>                //this.Width = 220;
>>>                //this.grdOrderItems.Width = 220;
>>>
>>>                //Order No column               
>>>
>>>                //Order Item Column
>>>                DataGridCustomTextBoxColumn colManPartNo = new DataGridCustomTextBoxColumn();
>>>                colManPartNo.Owner = this.grdOrderItems;
>>>                colManPartNo.HeaderText = "Item No";
>>>                colManPartNo.MappingName = "itemNo";
>>>                colManPartNo.Width = ((this.grdOrderItems.Width * 20) / 100);
>>>                colManPartNo.Alignment = HorizontalAlignment.Left;
>>>
>>>                // Unfortunately the Description column is not in OrderDetails table
>>>                //Order Item Description
>>>                DataGridCustomTextBoxColumn colDescription = new DataGridCustomTextBoxColumn();
>>>                colDescription.Owner = this.grdOrderItems;
>>>                colDescription.HeaderText = "Description";
>>>                colDescription.MappingName = "Description";
>>>                colDescription.Width = ((this.grdOrderItems.Width * 40) / 100);
>>>                colDescription.Alignment = HorizontalAlignment.Left;
>>>
>>>                DataGridCustomTextBoxColumn colQuantity = new DataGridCustomTextBoxColumn();
>>>                colQuantity.Owner = this.grdOrderItems;
>>>                colQuantity.HeaderText = "Qty";
>>>                colQuantity.MappingName = "Qty";
>>>                colQuantity.Width = ((this.grdOrderItems.Width * 10) / 100);
>>>                colQuantity.Alignment = HorizontalAlignment.Center;
>>>                
>>>                //Order Item Price
>>>                DataGridCustomTextBoxColumn colPrice = new DataGridCustomTextBoxColumn();
>>>                colPrice.Owner = this.grdOrderItems;
>>>                colPrice.HeaderText = "Price";
>>>                colPrice.MappingName = "Price";
>>>                colPrice.Width = ((this.grdOrderItems.Width * 15) / 100);
>>>                colPrice.Alignment = HorizontalAlignment.Right;
>>>                // Setup table mapping name
>>>
>>>                //Order Item Total Price
>>>                DataGridCustomTextBoxColumn colTotalPrice = new DataGridCustomTextBoxColumn();
>>>                colTotalPrice.Owner = this.grdOrderItems;
>>>                colTotalPrice.HeaderText = "Total";
>>>                colTotalPrice.MappingName = "TotalPrice";
>>>                colTotalPrice.Width = ((this.grdOrderItems.Width * 15) / 100);
>>>                colTotalPrice.Alignment = HorizontalAlignment.Right;
>>>
>>>                // Setup table mapping name
>>>                this.grdOrderItems.TableStyles[0].GridColumnStyles.Add(colManPartNo);
>>>                this.grdOrderItems.TableStyles[0].GridColumnStyles.Add(colDescription);
>>>                this.grdOrderItems.TableStyles[0].GridColumnStyles.Add(colQuantity);
>>>                this.grdOrderItems.TableStyles[0].GridColumnStyles.Add(colPrice);
>>>                this.grdOrderItems.TableStyles[0].GridColumnStyles.Add(colTotalPrice);
>>>                this.grdOrderItems.RowHeadersVisible = false;
>>>            }
>>>            this.grdOrderItems.DataSource = dt;
>>>            this.grdOrderItems.Refresh();
>>>        }
>>>
>>>>Look at this in your code,
>>>>
>>>>You repeated colPrice in [//Order Item Total Price] part instead of colTotalPrice data grid view column.
>>>>It seems you did a COPY - PATE
>>>>
>>>> //Order Item Price
>>>> DataGridCustomTextBoxColumn colPrice = new DataGridCustomTextBoxColumn();
>>>> colPrice.Owner = this.grdOrderItems;
>>>> colPrice.HeaderText = "Price";
>>>> colPrice.MappingName = "Price";
>>>> colPrice.Width = ((this.grdOrderItems.Width * 24) / 100);
>>>> colPrice.Alignment = HorizontalAlignment.Right;
>>>> // Setup table mapping name
>>>>
>>>> //Order Item Total Price
>>>> DataGridCustomTextBoxColumn colTotalPrice = new DataGridCustomTextBoxColumn();
>>>> colPrice.Owner = this.grdOrderItems;
>>>> colPrice.HeaderText = "Total";
>>>> colPrice.MappingName = "TotalPrice";
>>>> colPrice.Width = ((this.grdOrderItems.Width * 24) / 100);
>>>> colPrice.Alignment = HorizontalAlignment.Right;
Very fitting: http://xkcd.com/386/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform