473,597 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ControlParamete r...
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 1839

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

Similar topics

12
5304
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 dimensions (rows/columns)). Even if Python couldn't resolve the __init__ to use on the basis of argument types surely it could do so on the basis of argument numbers??? At any rate - any suggestions how I code this????
6
4013
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) like: <FRAMESET ROWS="*,*,*,*,*,100%" BORDER=0 FRAMEBORDER=0> <FRAME SRC="http://www.firstdomain.com/index.html" NAME="first" MARGINWIDTH=1 SCROLLING=NO TITLE=1> <FRAME SRC="http://www.secdomain.com/welcome.html" NAME="second" MARGINWIDTH=1...
22
3695
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, and some said it wasn't but it was for older versions of Postgres). Basically I would *love* to be able to do something like this: SELECT some_id
2
2427
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 the Columns dialog box from the properties of the datagrid, on the left that contains a select button. So now, when you press the button the whole row is highlighted. Now, what I want to do is have the user highlight as many rows as they wish...
8
1579
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 MULTIPLE ROWS even though it should only update one ROW !! THE WEIRDEST is that when i remove 2 of the update Rules on the VIEW The Update Query Works FINE !!!! WHY IS THAT HAPPENNING ??
2
4952
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 non-visible columns at the front? I have a page with a dynamic table. The table has some visible columns and some non-visible columns. The style "hide" is .hide { display:none; } <table id="SelectedList">
9
2036
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 could be 50 words long it is totally variable. What I want to do is take the number of words in $mystring, divide by three and insert a <brat the end of each "line".
2
4606
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 copied all other rows. Can anybody help me what to do. Dim myBuilder As SqlCommandBuilder = New SqlCommandBuilder(adapterGetBudget) Dim dtdate As Date = Date.Now Dim cmd As New SqlCommand() With cmd .CommandType = CommandType.StoredProcedure
3
3912
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 messing up. Problems:
3
4917
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'); var lastRow = tbl.rows.length; // if there's no header row in the table, then iteration = lastRow + 1
0
7959
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7883
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8263
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5842
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3917
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2393
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1492
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.