473,657 Members | 2,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid boundcolumn problem

I want to use a datagrid with my display, but I don't want to use 1 row per
record.

What I have is a record with up to 6 values -
(answer1,answer 2,answer3,answe r4,answer5,answ er6). I want to display them
with alternating styles. One record may only have the first 3 fields with
data and another with 4 and still another with 6.

I want it to show as:

Answer1
Answer2
Answer3

or

Answer1
Answer2
Answer3
Answer4
Answer5

Can I set up a DataGrid this way?

Thanks,

Tom

Nov 18 '05 #1
5 1157
That looks more like a datalist than a datagrid.

Also, for horizontal display, you might want to if this grid is of any use
to you:

http://www.denisbauer.com/ASPNETCont...ierarGrid.aspx
"tshad" <ts**********@f tsolutions.com> wrote in message
news:OC******** ******@TK2MSFTN GP15.phx.gbl...
I want to use a datagrid with my display, but I don't want to use 1 row per
record.

What I have is a record with up to 6 values -
(answer1,answer 2,answer3,answe r4,answer5,answ er6). I want to display them
with alternating styles. One record may only have the first 3 fields with
data and another with 4 and still another with 6.

I want it to show as:

Answer1
Answer2
Answer3

or

Answer1
Answer2
Answer3
Answer4
Answer5

Can I set up a DataGrid this way?

Thanks,

Tom


Nov 18 '05 #2
Tom,

If I understand you correctly, you want to show one record field per line.
For this you can bind you datagrid (or datalist as Ken has noted) to a
dataset with a table that will have records with one field only. You can
convert your original records to this new table either in a stored procedure
or in the code. In the latter case you will have to get the original table
in a dataset first, loop through the records and add every field with a
value to your new table as a separate row. Then bind the datagrid/datalist
to the new table.

Eliyahu

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OC******** ******@TK2MSFTN GP15.phx.gbl...
I want to use a datagrid with my display, but I don't want to use 1 row per record.

What I have is a record with up to 6 values -
(answer1,answer 2,answer3,answe r4,answer5,answ er6). I want to display them
with alternating styles. One record may only have the first 3 fields with
data and another with 4 and still another with 6.

I want it to show as:

Answer1
Answer2
Answer3

or

Answer1
Answer2
Answer3
Answer4
Answer5

Can I set up a DataGrid this way?

Thanks,

Tom

Nov 18 '05 #3

"Ken Cox [Microsoft MVP]" <BA************ @sympatico.ca> wrote in message
news:O4******** ******@TK2MSFTN GP15.phx.gbl...
That looks more like a datalist than a datagrid.

Also, for horizontal display, you might want to if this grid is of any use
to you:

http://www.denisbauer.com/ASPNETCont...ierarGrid.aspx

This might do what I am trying to do, but it doesn't solve the 6 fields in
one record problem. Here is what I am trying to achieve.

As I added in my last post, my table is:

CREATE TABLE [dbo].[ScreenQuestions] (
[PositionID] [int] NOT NULL ,
[Unique] [int] NOT NULL ,
[Question] [text] NULL ,
[QuestionType] [char] (10) NULL ,
[Answer1] [text] NULL ,
[Answer2] [text] NULL ,
[Answer3] [text] NULL ,
[Answer4] [text] NULL ,
[Answer5] [text] NULL ,
[Answer6] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

What I want to do is set up a datalist that display all the questions., then
if the user pushes a button, it will display the answers below the question.
Something like:

+ Question 1
+ Question 2
+ Question 3

Then like a tree, if you push the "+" on a question, the answers will show
below in a grid, something like:

+ Question 1
- Question2
Answer1
Answer2
Answer3
Answer4
Answer5
+ Question3

Thanks,

Tom
"tshad" <ts**********@f tsolutions.com> wrote in message
news:OC******** ******@TK2MSFTN GP15.phx.gbl...
I want to use a datagrid with my display, but I don't want to use 1 row
per
record.

What I have is a record with up to 6 values -
(answer1,answer 2,answer3,answe r4,answer5,answ er6). I want to display
them
with alternating styles. One record may only have the first 3 fields
with
data and another with 4 and still another with 6.

I want it to show as:

Answer1
Answer2
Answer3

or

Answer1
Answer2
Answer3
Answer4
Answer5

Can I set up a DataGrid this way?

Thanks,

Tom

Nov 18 '05 #4
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Tom,

If I understand you correctly, you want to show one record field per line.
For this you can bind you datagrid (or datalist as Ken has noted) to a
dataset with a table that will have records with one field only. You can
convert your original records to this new table either in a stored
procedure
or in the code. In the latter case you will have to get the original table
in a dataset first, loop through the records and add every field with a
value to your new table as a separate row. Then bind the datagrid/datalist
to the new table.
Are you talking about doing this just for the ASP page?

I assume you are talking about just getting rid of the old table completely
and create 2 (normalize).

CREATE TABLE [dbo].[ScreenQuestions] (
[PositionID] [int] NOT NULL ,
[Unique] [int] NOT NULL ,
[Question] [text] NULL ,
[QuestionType] [char] (10) NULL ,
[Answer1] [text] NULL ,
[Answer2] [text] NULL ,
[Answer3] [text] NULL ,
[Answer4] [text] NULL ,
[Answer5] [text] NULL ,
[Answer6] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

and change it to 2 tables:

CREATE TABLE [dbo].[ScreenQuestions] (
[PositionID] [int] NOT NULL ,
[Unique] [int] NOT NULL ,
[Question] [text] NULL ,
[QuestionType] [char] (10) NULL ,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[ScreenAnswers] (
[PositionID] [int] NOT NULL ,
[Unique] [int] NOT NULL ,
[Unique2] [int] NOT NULL,
[Answer] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

I was trying to get away from that, if possible.

At this point, I haven't got much data in the tables, as I am just starting
to set this up.

Thanks,

Tom
Eliyahu

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OC******** ******@TK2MSFTN GP15.phx.gbl...
I want to use a datagrid with my display, but I don't want to use 1 row

per
record.

What I have is a record with up to 6 values -
(answer1,answer 2,answer3,answe r4,answer5,answ er6). I want to display
them
with alternating styles. One record may only have the first 3 fields
with
data and another with 4 and still another with 6.

I want it to show as:

Answer1
Answer2
Answer3

or

Answer1
Answer2
Answer3
Answer4
Answer5

Can I set up a DataGrid this way?

Thanks,

Tom


Nov 18 '05 #5
Now is it much clearer. You have a standard case of master-details
relationship. Yes, you need 2 tables for this, as you suggest. You don't
need to get away from that. One table is a very bad idea.

Eliyahu

"tshad" <ts**********@f tsolutions.com> wrote in message
news:eO******** ******@TK2MSFTN GP14.phx.gbl...
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Tom,

If I understand you correctly, you want to show one record field per line. For this you can bind you datagrid (or datalist as Ken has noted) to a
dataset with a table that will have records with one field only. You can
convert your original records to this new table either in a stored
procedure
or in the code. In the latter case you will have to get the original table in a dataset first, loop through the records and add every field with a
value to your new table as a separate row. Then bind the datagrid/datalist to the new table.
Are you talking about doing this just for the ASP page?

I assume you are talking about just getting rid of the old table

completely and create 2 (normalize).

CREATE TABLE [dbo].[ScreenQuestions] (
[PositionID] [int] NOT NULL ,
[Unique] [int] NOT NULL ,
[Question] [text] NULL ,
[QuestionType] [char] (10) NULL ,
[Answer1] [text] NULL ,
[Answer2] [text] NULL ,
[Answer3] [text] NULL ,
[Answer4] [text] NULL ,
[Answer5] [text] NULL ,
[Answer6] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

and change it to 2 tables:

CREATE TABLE [dbo].[ScreenQuestions] (
[PositionID] [int] NOT NULL ,
[Unique] [int] NOT NULL ,
[Question] [text] NULL ,
[QuestionType] [char] (10) NULL ,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[ScreenAnswers] (
[PositionID] [int] NOT NULL ,
[Unique] [int] NOT NULL ,
[Unique2] [int] NOT NULL,
[Answer] [text] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

I was trying to get away from that, if possible.

At this point, I haven't got much data in the tables, as I am just starting to set this up.

Thanks,

Tom

Eliyahu

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OC******** ******@TK2MSFTN GP15.phx.gbl...
I want to use a datagrid with my display, but I don't want to use 1 row

per
record.

What I have is a record with up to 6 values -
(answer1,answer 2,answer3,answe r4,answer5,answ er6). I want to display
them
with alternating styles. One record may only have the first 3 fields
with
data and another with 4 and still another with 6.

I want it to show as:

Answer1
Answer2
Answer3

or

Answer1
Answer2
Answer3
Answer4
Answer5

Can I set up a DataGrid this way?

Thanks,

Tom



Nov 18 '05 #6

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

Similar topics

0
1378
by: Robert Brinson | last post by:
Hello all! I'm running .NET Framework 1.1 using VS.NET 2003. I've got a mystery with a DataGrid. Below is the definition of the DataGrid from my aspx page: </asp:datagrid><asp:datagrid id="dgDetails" Runat="server" Width="100%" Visible="False" AllowSorting="True" CellPadding="1" CellSpacing="0" AutoGenerateColumns="False" OnSortCommand="SortDetails"> <ItemStyle Font-Size="XX-Small" Font-Names="Tahoma"></ItemStyle> <HeaderStyle...
2
3291
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object reference not set to an instance of an object". This error message commonly occurs when a server control is incorrecly declared, so naturally I have double checked this. To test this, I moved the aspx code for the DataGrid ('myNestedDataGrid')...
3
4871
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 the best method? Do you have a sample of how to do this?
8
1943
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a button that inserts a new row in the SQL table and then refresh the datagrid.
2
1397
by: wolfgang wagner | last post by:
hi all! im trying to edit data in a datagrid (like described here: http://aspnet.4guysfromrolla.com/articles/071002-1.aspx) but if i click the edit button i get the following error invalid attempt to FieldCount because datareader is already closed (sorry, this error message is translated from german) when trying to do the databinding.
5
2774
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
5
6694
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious missing here, but after 2 days I am ready to explode ! Please help. To create the Delete button I selected the grid in design view, clicked the "Columns" property and added the Delete button in the
4
2124
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a Delete button on the end of each row. I am unable to gain access to the event when the button is clicked. I don't fully understand how the click gets connected to the C# code,
0
2077
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any help........pls urgent ========================================================= <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb" Inherits="TestDatagrids.WebForm3"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">...
0
1655
by: webaccess | last post by:
Hi Friends ..!! I want to use datagrid/dataview control to data in tablular format,also I want to add paging and format the data of table column. Problem is data is coming from API Dom in as XML source. Now to display data i hv use dataset to fetch data.so i m displaying data in datagrid/dataview. Now here comes a problem: Using Datagrid :
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.