Adding new rows in Datalist

  • Thread starter Thread starter anon
  • Start date Start date
A

anon

Hi All,
I would like to make a datalist which takes new information by allowing
users(with some button or link) to add new rows to a datalist with some
information and save the information.....is it even possible to do with
a datalist or shud i use only a datagrid...
any ideas or online samples/URLS would be greatly appreicated ...
thanks for ur time
Ben
 
anon said:
Hi All,
I would like to make a datalist which takes new information by allowing
users(with some button or link) to add new rows to a datalist with some
information and save the information.....is it even possible to do with
a datalist or shud i use only a datagrid...
any ideas or online samples/URLS would be greatly appreicated ...
thanks for ur time

You don't want to add rows to the DataList. You want to add rows to the
DataSource which you have bound to the DataList.
 
yeah...but on the UI the user shud be able to see a new row as part of
the datalist to be able to add data which wud be added to the datasource
and then DB....
does anyone have any links that would be useful to explore this issue
further?
Thanks,
Ben
 
anon said:
yeah...but on the UI the user shud be able to see a new row as part of
the datalist to be able to add data which wud be added to the datasource
and then DB....
does anyone have any links that would be useful to explore this issue
further?

Sorry, I wasn't thinking.

Put the controls for a new row into the footer of the DataList. You might
want to put a "New" button in there as well. When "New" is clicked, make the
controls in the footer visible and set a "NewRecord" state in a Session
variable. This should include "Save" and "Cancel" buttons. When "Save" is
clicked, save the data to the database, clear the "NewRecord" state, make
the footer controls invisible, and rebind the DataList. When "Cancel" is
clicked, just clear the "NewRecord" state and make the footer controls
invisible.

I've done this with DataGrids, and it works fine. I see no reason why it
couldn't work for a DataList.
 

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

Back
Top