473,404 Members | 2,137 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,404 software developers and data experts.

Feasibility of Dynamically-Generated Textboxes

I'm working on administration panel that will ultimately allow the
client to edit products in a collection. Each ProjectList can have
multiple products within it. I was asked to create something that will
allow them to edit the products within that list. I was thinking of
writing using a DataReader and spitting the values out into textboxes.
The only problem is that I won't know beforehand what the textboxes
would be called. In the past creating stuff like this I would know that
I needed textboxes named, tbFirstName, tbLastName, tbEmail, tbZip,
etc... This project is going to have to be more dynamic than that. If
you don't think that dynamically-generated textboxes are the best way
to go I would certainly welcome any opinions.

If you think the textbox idea would work please offer suggestions.

Thanks,

- Will

Nov 19 '05 #1
5 1029
> If you think the textbox idea would work please offer suggestions.

I'm not quite sure exactly what you are asking, but when I have to present a
list of multiple items to be edited and I don't know how many there will be,
I just use a string builder and write them out within loop:

count = #items

while count > 0
sb.append("<input type='text' id='textbox_" & count & "'>")
end while

-Darrel
Nov 19 '05 #2
Darrel: You hit the nail right on the head. I thought about building a
string but wasn't sure how to update the database if more than 1 of the
items were edited.

strSQL as string = UPDATE SET ...

How would I tackle the issue of editing everything that was changed? In
the past I have used a boolean for bolTextBoxChanged and have it set to
false at page load. Each textbox would then have
onTextChanged=bolTextBoxChanged even that would set it to true. I still
don't know how to loop through and create the SQL statements.

Nov 19 '05 #3
I didn't even think about EditCommandColumn!

Nov 19 '05 #4
> Darrel: You hit the nail right on the head. I thought about building a
string but wasn't sure how to update the database if more than 1 of the
items were edited.


My way is probably not the most efficient way, but I just go ahead and loop
through each one updating the record for each. Yes, it means I'm updating
records that didn't actually have data change, so in those cases, your
method of adding another flag might work well.

-Darrel
Nov 19 '05 #5
I actually got it to work today using EditCommandColumn. This way the
client can update 1 or 5 fields if they wish. I thought about doing it
your way early on but some of the projectLists can contain 100-500+
products.

Thanks again.

Nov 19 '05 #6

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

Similar topics

20
by: David | last post by:
I have a one-line script to add an onunload event handler to the body of the document. The script is as follows: document.getElementsByTagName("BODY").onunload=function s() {alert("s")} Now...
7
by: Tim T | last post by:
Hi, I have the need to use dynamically loaded user controls in a webform page. I have the controls loading dynamically, and that part works fine. this is the code used in a webform to dynamically...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
8
by: Asfand Yar Qazi | last post by:
Hi, I have the following header file in my 'everything useful I think of in one place' library: ============= BEGIN CODE SNIPPET =========== /** All classes that derive from this obtain a...
2
by: Pete Moss | last post by:
During a postback event, I am having trouble retrieving the state of a CheckBox Control that I am dynamically adding to a DataGrid Control using ASP.NET 1.1. I have no trouble adding the...
7
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows...
5
by: Nathan Sokalski | last post by:
I have a custom control that I wrote (I inherit from System.Web.UI.WebControls.CompositeControl). I dynamically add this control to my Page, but I was told that dynamically added controls do not...
4
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.