473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

datagrid columns

I have a datagrid that's using a dataread to display rows from SQL Server. I
have autogenerate columns turned off. When I add columns in code behind (VB),
I don't get the columns displayed correctly. If I add the columns in the web
page as part of the html, it works. I have other grids that work correctly
with the VB code, and have tried replacing the grid, building the page from
scratch, and still get the same result. Any ideas? Thanks in advance.
Feb 10 '06 #1
2 1184
Not correctly in what way? Is the text upside down? Describe what's wrong
and show the code that you're using to produce the columns, please.

Ray at home

"R Riness" <rr*****@nospam.att.net> wrote in message
news:DD**********************************@microsof t.com...
I have a datagrid that's using a dataread to display rows from SQL Server.
I
have autogenerate columns turned off. When I add columns in code behind
(VB),
I don't get the columns displayed correctly. If I add the columns in the
web
page as part of the html, it works. I have other grids that work correctly
with the VB code, and have tried replacing the grid, building the page
from
scratch, and still get the same result. Any ideas? Thanks in advance.

Feb 10 '06 #2
Not all of the columns are displayed (only 2 of 3) and style sheet isn't
applied. Here's the VB code:

ScheduleReader = cm.ExecuteReader
If ScheduleReader.HasRows Then
strSchedule = "Schedule"
dgSchedule.AutoGenerateColumns = False
Dim dgcDate As New BoundColumn
With dgcDate
.DataField = "SubjectDate"
.HeaderText = "Due Date"
.ItemStyle.CssClass = "SectionScheduleDate"
End With
dgSchedule.Columns.Add(dgcDate)
Dim dgcSubject As New BoundColumn
With dgcSubject
.DataField = "Subject"
.HeaderText = "Subject"
.ItemStyle.CssClass = "SectionScheduleSubject"
End With
dgSchedule.Columns.Add(dgcSubject)
Dim dgcComment As New BoundColumn
With dgcDate
.DataField = "Comment"
.HeaderText = "Comment"
.ItemStyle.CssClass = "SectionScheduleComment"
End With
With dgSchedule
.Columns.Add(dgcComment)
.DataSource = ScheduleReader
.DataBind()
End With
Else
strSchedule = "Schedule Not Available"
End If
ScheduleReader.Close()

Thanks for your help.

"Ray Costanzo [MVP]" wrote:
Not correctly in what way? Is the text upside down? Describe what's wrong
and show the code that you're using to produce the columns, please.

Ray at home

"R Riness" <rr*****@nospam.att.net> wrote in message
news:DD**********************************@microsof t.com...
I have a datagrid that's using a dataread to display rows from SQL Server.
I
have autogenerate columns turned off. When I add columns in code behind
(VB),
I don't get the columns displayed correctly. If I add the columns in the
web
page as part of the html, it works. I have other grids that work correctly
with the VB code, and have tried replacing the grid, building the page
from
scratch, and still get the same result. Any ideas? Thanks in advance.


Feb 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Reb | last post by:
I am using a datagrid within another datagrid. My second datagrid is expand/collapse one. I am facing some error. This is my code. ExpandGrid.aspx <form id="Form1" method="post"...
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
7
by: CanoeGuy | last post by:
I have been trying for the last two weeks to display a dynamic DataGrid. The data that I'm pulling from a SQL Server DB will have whole columns that will be either NULL or 0. I want to display...
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
7
by: Arpan | last post by:
Assume that a database table has the following 4 columns - ID, UserID, Subject & Marks. I am retrieving the records existing in this DB table & displaying them in a DataGrid like this: <script...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.