473,320 Members | 1,794 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,320 software developers and data experts.

Adding multiple rows through two-way Data binding

Hi,

I have an ASP.NET page with a ListBox that is data bound to a table
with a single field (it holds a list of valid IDs). The page also has
a textBox into which you can add new valid IDs, one per line (this is
in order to make the process of adding new IDs easy, since it's only
done at time of configuration).

I have no problem with retrieving the contents of the textBox,
splitting it into a string array, validating the individual IDs, and
then creating a dynamic INSERT... but I have a feeling there's a
better ASP.NETish way, and since I'm learning I'm trying to do it in
the most elegant and declarative way.

I thought of two approaches, with which I've been struggling (because
documentation is very sparse for the large topic of data binding):

1 - Add the new IDs into my data bound ListBox and call DataBind() (or
some other method) in the hopes that the two-way data binding will
kick in and add all the new records. I haven't found any documentation
that suggests this will work, however...

2 - Programatically load the parameter into the SQLDataSource and call
the Insert() method so the InsertCommand gets executed.

I feel that number 2 should work... however, I found no way to specify
the parameters or the insert command so that I can insert many new
records with just one command. Is it possible? Is there some better
way than dynamic SQL?

Also, I want to add a button that will allow me to delete the records
selected in the ListBox. Approach number 1 seems more likely here, but
the closest I found to what I need is using a ControlParameter...
however, the ListBox allows multiple selections, so once again I don't
know if it's possible to avoid using a dynamic SQL command (and use
data binding instead) to delete many records at once.

Cheers,
Eric

May 9 '07 #1
0 1819

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

Similar topics

12
by: Philip Smith | last post by:
Call this a C++ programmers hang-up if you like. I don't seem to be able to define multiple versions of __init__ in my matrix class (ie to initialise either from a list of values or from 2...
6
by: Wladimir Borsov | last post by:
I would like to load multiple web pages from Internet into ONE single browser window - one below the other. How do I do that most easily ? One idea is to built a frameset (for e.g 6 web pages)...
22
by: Christopher Murtagh | last post by:
Greetings, I'm trying to write a pl/perl function that will return multiple rows. I've looked all over the web and only found vague references as to how to do this (some said it was possible,...
2
by: Bob Hollness | last post by:
Hi group. I am a newbie to ASP.NET as you will see from some of the questions I may ask! I have a datagrid which I have populated from a database. It works great! I have added a column, via...
8
by: Najib Abi Fadel | last post by:
Hi all i am running PostgreSQL 7.3.2, i have a VIEW for which i implemented multiple RULES on UPDATE. The weird think is that the Update Query corresponding to one of the rules is updating...
2
by: dschectman | last post by:
This appears to be a feature of IE JavaScript. I am running IE 6.0 with the latest patches from Microsoft. Are there any workarounds other than re-coding the source HTML to place all the...
9
by: howarthc | last post by:
OK - here is what I want to do - but I am lost how to do it. I have a variable $mystring = "one two three four five six seven eight nine" This variable $mystring can be 4 words long or it...
2
by: mdfayazi | last post by:
I am using dataadapter to Add,Update,Delete rows in a datagridview.Update and delete are working but while adding a rows the problem comes.When I add more than one row only first row values are...
3
by: nigelesquire | last post by:
Please help! I'm trying to clone and delete multiple rows with JavaScript. I need two delete buttons that work...! I only have one for now, but it's not working properly, the output count is...
3
by: didi86 | last post by:
Please help me to adding multiple row at a time... // Last updated 2006-02-21 <script language="javascript"> function addRowToTable() { var tbl = document.getElementById('tblSample'); ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.