Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 138749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:18:48+00:00 2026-05-11T07:18:48+00:00

I thought this would be simple, but I sure am having a lot of

  • 0

I thought this would be simple, but I sure am having a lot of trouble doing this:

The title of this question may be a bit misleading. I don’t have to use a gridview. In fact, I know the GridView is probably not the way to go on this. I just didn’t know how else to title it. But, for now just consider:

I have a very simple class called Student. It has 4 properties: int ID string FirstName string LastName string Email

I want to keep a generic collection of these in memory (session state): List students;

Ok, now the problem: I want the user to create as many of these Student objects as they want. For displaying these I just want a simple table of some kind with the 3 textboxes on each row. I would like every row to have textboxes insead of labels so that any record can be edited at anytime.

When the user is finished created their student objects, then they proceed on to do other things. But, I am just having trouble finding a way to display the records this way. Do I use the ListView(3.5), html table, gridview, repeater, etc.?

How would you do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:18:48+00:00Added an answer on May 11, 2026 at 7:18 am

    I would be inclined to use the ListView personally for this, since you can insert Rows with it. Your LayoutTemplate would be a table with a <tr runat=’server’ ID=’itemPlaceHolder’ /> in it. Your ItemTemplate would have your TextBox’s (and optional a save button per row. Then you could have an InsertItemTemplate if you need inserts as well.

    Anywhere on the page you can add a button to Save all items by looping through the ListView.Item collection and calling ListView.Update(itemIndex, validate).

    <asp:ListView runat='server' ID='lv' InsertItemPosition='LastItem' DataKeyNames='id'> <LayoutTemplate>     <asp:LinkButton runat='server' OnClick='SaveAll' Text='Save All' />     <table>     <tr>         <th>First Name</th>         <th>Last Name</th>         <th>Email</th>     </tr>     <tr runat='server' id='itemPlaceHolder' />     </table>     <asp:LinkButton runat='server' OnClick='SaveAll' Text='Save All' /> </LayoutTemplate> <ItemTemplate>     <tr>         <td><asp:TextBox runat='server' ID='firstName' Text='<%#Bind('firstName') %>' /></td>         <td><asp:TextBox runat='server' ID='firstName' Text='<%#Bind('lastName') %>' /></td>         <td><asp:TextBox runat='server' ID='firstName' Text='<%#Bind('email') %>' /></td>         <td><asp:LinkButton runat='server' CommandName='update' Text='Save' /></td>     </tr> </ItemTemplate> <InsertItemTemplate>     <tr>         <td><asp:TextBox runat='server' ID='firstName' Text='<%#Bind('firstName') %>' /></td>         <td><asp:TextBox runat='server' ID='firstName' Text='<%#Bind('lastName') %>' /></td>         <td><asp:TextBox runat='server' ID='firstName' Text='<%#Bind('email') %>' /></td>         <td><asp:LinkButton runat='server' CommandName='insert' Text='Save' /></td>     </tr> </InsertItemTemplate> </asp:ListView>  protected void SaveAll(object sender, EventArgs e) {     lv.Items.ToList().ForEach(li => lv.UpdateItem(li.DataItemIndex, true)_; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought this would be fairly simple but it turns out not to work
I would have thought this one would be simple but I'm trying to change
OK so I thought this would be pretty simple but it's tripping me up..
having a bit of a prob with this, though I'm sure it's simple! I
OK -this might be simple but i'm having trouble visualising where i need to
I thought this would be very simple but I'm struggling a little. I'm working
Ok, I thought this would be simpler but I was probably wrong.. My parser
I thought it would be as simple as this... $('#yourSelect').change(function () { if ($(this).val()
This is what I thought would be a simple select clause, however the following
This should be so simple... I thought it would be nice to try the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.