Adding rows to gridview

G

Guest

I'm working on a questionaire, and I'd like to add the questions to a
gridview, so that each row (of two "columns" each) has the question in one
field, and the editable section (where the user will enter the answer) in the
next field. The questions are not stored in a table, and I'm thinking of
saving the answers manually (i.e. no datasource). Is this possible?
This is a web app using asp.net 2.0.

THanks.
 
K

Ken Cox [Microsoft MVP]

If you're using ASP.NET 2.0, you might be able to use the built-in Profiles
database to store the questions and answers. Depending on the number of
respondents, you *might* get away with using the .Net 2.0 Updatable Xml
DataSource Control

http://www.chaliy.com/Sources/Default.aspx

Ken
Microsoft MVP [ASP.NET]
 
B

Bruno Alexandre

if you use a DataSource you have to be bound to that DataSource, for example
a XML file,
the other way arround is to build a DataTable and Bound the GridView to the
the DataTable

adding rows to the DataTAble is as easy as

Dim dataRowObject as DataRow
dataRowObject("column1") = "value 1"
dataRowObject("column2") = "value 2"

DataTableObject.Rows.Add( dataRowObject )

and then you can end up with

GridView.DataSource = DataTableObject
GridView.Bind()


the DataTable is very powerfull and you should read more about it, there's a
lot of examples over the web
you can also, remove, sort, perform operations and a lot of other nice
things to the DataTable object.
 
C

Cowboy \(Gregory A. Beamer\)

I am not sure Profile would be the best answer, unless this is a one time
quiz per user. If you ever wanted to add additional tests or additional
questions, you would end up with inconsistent profiles, or worse.
Interesting solution, however*. :)

* I love outside of the box thinking
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
Ken Cox said:
If you're using ASP.NET 2.0, you might be able to use the built-in
Profiles database to store the questions and answers. Depending on the
number of respondents, you *might* get away with using the .Net 2.0
Updatable Xml DataSource Control

http://www.chaliy.com/Sources/Default.aspx

Ken
Microsoft MVP [ASP.NET]


VMI said:
I'm working on a questionaire, and I'd like to add the questions to a
gridview, so that each row (of two "columns" each) has the question in
one
field, and the editable section (where the user will enter the answer) in
the
next field. The questions are not stored in a table, and I'm thinking of
saving the answers manually (i.e. no datasource). Is this possible?
This is a web app using asp.net 2.0.

THanks.
 
C

Cowboy \(Gregory A. Beamer\)

Anything is possible. You can save the answer off a variety of ways. One is
to use ADO.NET DataTables (as Bruno has suggested). You can then save using
ADO.NET (as a csv file, for example) or just save the XML as XML. It really
depends on how you are later going to consume the data. As XML, you simply
suck the XML back into a DataTable and start rolling. In fact, you can use
multiple tables and save what, in essence, becomes a mini file based
database. If you store a file per user, you would be best served to either
consistently name (which can be tricky if you end up with two people with
similar names, for example) or have another file saved that tells which file
matches which user.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
 
Joined
Mar 6, 2007
Messages
1
Reaction score
0
Generating Rows To The Gridview Control In Web Application.(vs2005)

HI..
WELL..THIS IS SHAILESH,RECENTLY STARTED MY CAREER WITH 'CDAC-R&D'.

i am creating a web application in vs2005 with c#.
I am creating a gridview control in web application,which has some column fields.I am giving facility to the user to enter the data through cells of gridview there itself,provided cell templates as text box.After entering first record ,a 'NEXT RECORD'button is provided,clicking on which a new row below the previous should be generate.
problem statement:=>'HOW CAN I GENERATE THE NEW ROW WHEN BUTTON IS PREASSED!'???
PLZ..KINDLY REPLAY!OR SEND MAIL TO->
'(e-mail address removed)'
code/demo for the currouspinding problem statement are most welcome!
thanks n regards!
shailesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top