Adding rows to gridview

Discussion in 'ASP .Net' started by =?Utf-8?B?Vk1J?=, Aug 22, 2006.

  1. 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.
     
    =?Utf-8?B?Vk1J?=, Aug 22, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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.
     
    Ken Cox [Microsoft MVP], Aug 22, 2006
    #2
    1. Advertising

  3. 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" <> escreveu na mensagem
    news:...
    > 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.
     
    Bruno Alexandre, Aug 22, 2006
    #3
  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]" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >> 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.

    >
    >
     
    Cowboy \(Gregory A. Beamer\), Aug 23, 2006
    #4
  5. 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" <> wrote in message
    news:...
    > 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.
     
    Cowboy \(Gregory A. Beamer\), Aug 23, 2006
    #5
  6. =?Utf-8?B?Vk1J?=

    shaileshcdac

    Joined:
    Mar 6, 2007
    Messages:
    1
    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->
    ''
    code/demo for the currouspinding problem statement are most welcome!
    thanks n regards!
    shailesh
     
    shaileshcdac, Mar 6, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    adding totals in gridview rows

    John, Jun 9, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    609
  2. Loading name...

    adding rows in GridView

    Loading name..., Aug 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    4,481
    John Timney \(MVP\)
    Aug 25, 2006
  3. WebBuilder451

    adding rows dynamically to a gridview problem

    WebBuilder451, Sep 9, 2008, in forum: ASP .Net
    Replies:
    7
    Views:
    2,330
  4. Jeff

    Adding rows to GridView

    Jeff, Dec 31, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    714
  5. VijayRama
    Replies:
    2
    Views:
    2,357
    Gregory A. Beamer
    Oct 12, 2009
Loading...

Share This Page