473,386 Members | 2,129 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,386 software developers and data experts.

Adding rows to gridview

VMI
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.
Aug 22 '06 #1
4 8734
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" <VM*@discussions.microsoft.comwrote in message
news:03**********************************@microsof t.com...
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.

Aug 22 '06 #2
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.
--

Bruno Alexandre
"a Portuguese in København, Danmark"

"VMI" <VM*@discussions.microsoft.comescreveu na mensagem
news:03**********************************@microsof t.com...
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.

Aug 22 '06 #3
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!
*************************************************
"VMI" <VM*@discussions.microsoft.comwrote in message
news:03**********************************@microsof t.com...
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.

Aug 23 '06 #4
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 [Microsoft MVP]" <BA**********@newsgroups.nospamwrote in message
news:Ow*************@TK2MSFTNGP03.phx.gbl...
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" <VM*@discussions.microsoft.comwrote in message
news:03**********************************@microsof t.com...
>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.


Aug 23 '06 #5

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

Similar topics

1
by: Loading name... | last post by:
hey asp.net 2.0 Is it possible to add records to a database via a GridView, I mean in the GridView the user add new rows which are saved back to the database? I know I can edit rows, but...
1
by: JB | last post by:
I'm dynamically creating a Gridview object and filling it with contents from an ArrayList as follows: GridView2.AutoGenerateColumns = true; GridView2.DataSource = ArrayListObject;...
2
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent...
0
by: ganesh22 | last post by:
Hi... Iam using GridView in asp.net(2.0) .My requirement is user can add,update,delete in gridview I written the code for add & update but can u help adding rows in grid view My code: ...
1
by: bJames | last post by:
Hi I've been all around looking for an answer to this question, but can't find it. I've got a gridview with a single unbound column. It's got a textbox and button in the footer row. I"m trying to...
2
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
1
by: COHENMARVIN | last post by:
I have a gridview and I need to know the number of rows in it. I find the Page_load and the Gridview_Load events are too early to find out the number of rows. I can use the Gridview_databound...
2
by: shrikanthn | last post by:
Hi All, i am adding some data into GridView (adding 4 to 5 rows) at runtime in asp.net page using c#. but getting outofbond error.
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...

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.