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

C# code for dynamic text boxes

1
Hi,
I am a novice programmer. I have a question regarding asp.net ver 2.0 using C#. I was goin through some excercies and found this one. Say I have a paint shop .... I have to create a website in such a way that user can enter length and breadth of the room. There might be few openings in the room which I dont wanna paint. I should ask the user to enter number of openings..when he enters say n, the website should dynamically create n*2 textboxes ( so that user could enter length and breadth of n). Finaly I should be able to calculate total paint( 35Sqfeet/Gallon) using area of the room-number of openings.

I hope you understood the question. Please help me code this!!
Oct 2 '06 #1
2 3728
JohannC
15
Hi There ,

The Best way would be to read the amount of openings and run it in a for loop.

in each for loop you can create a textbox by using the TextBox txtbox1= new TextBox and adding the control to a Table by running the table-cell serverside and using the Cell.Controls.Add( txtbox1) command.

Hope you get it :)
Oct 2 '06 #2
radcaesar
759 Expert 512MB
Hi,
Never prefer this kind of approach when getting input from the user. If n value will be large then the n*2 controls will set a severe pain to ur application. Also it will fail during Testing. Try to use another safer way to get input from user.

:)
Oct 3 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
4
by: Brian Shannon | last post by:
I have 3 combo boxes and two date text boxes on a .aspx page. The user can fill in any of the 5 controls or none to filter a datagrid. I was hoping someone could explain how to efficiently build...
0
by: Marty U. | last post by:
I am building a 3 level deep heirarchy tree for an application requirement. I need the ability at any level to add an item to the tree. However, when something is added all 3 levels must be...
1
by: priya | last post by:
hi.i made mistake while copying my code sorry friends.This is the one i tried .i got o/p for dynamic rows how should i h'v to incorporate "onChange"event in "setAttribute". following code is not...
4
by: pbsree | last post by:
how to generate multiple dynamic text boxes
0
by: Nolanclark | last post by:
Hi there. I've read a previous thread regarding the Old VB 6 checkbox array and how it's not really needed any more. That's fine, but I'm not really sure how to implement the checkbox control array...
0
by: cruz | last post by:
Hi all, I am now developing an asp.net/C# web application. In this, in one aspx (say 'Parent page') page I am using two Iframes. Each Iframe source file (that are also .aspx file, say 'child1' and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.