473,786 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamilaccy created textboxs

81 New Member
Hi
Iam using below code for creating dynamically textboxs bt the below code is creating only one vertical row for textboxs now i want 3 vertical rows can u give a code??

Expand|Select|Wrap|Line Numbers
  1. using System.Collections.Generic;
  2.  
  3. public partial class _Default : System.Web.UI.Page
  4. {
  5.    int controlCounter = 0;
  6.    List<string> myControlList;
  7.  
  8.    protected override void LoadViewState(object savedState)
  9.    {
  10.       base.LoadViewState(savedState);
  11.       myControlList = (List<string>)ViewState["myControlList"];
  12.       foreach (string ctlID in myControlList)
  13.       {
  14.          controlCounter++;
  15.          TextBox box = new TextBox();
  16.          box.ID = ctlID;
  17.          LiteralControl lineBreak = new LiteralControl("<br />");
  18.          controlHolder.Controls.Add(box);
  19.          controlHolder.Controls.Add(lineBreak);
  20.       }
  21.    }
  22.  
  23.    protected void Page_Load(object sender, EventArgs e)
  24.    {
  25.       if (!IsPostBack)
  26.       {
  27.          myControlList = new List<string>();
  28.          ViewState["myControlList"] = myControlList;
  29.       }
  30.    }
  31.  
  32.    protected void addControlButton_Click(object sender, EventArgs e)
  33.    {
  34.       controlCounter++;
  35.       TextBox box = new TextBox();
  36.       box.Text = "a new text Box";
  37.       box.ID = "textBox" + controlCounter.ToString();
  38.       LiteralControl lineBreak = new LiteralControl("<br />");
  39.       controlHolder.Controls.Add(box);
  40.       controlHolder.Controls.Add(lineBreak);
  41.       myControlList.Add(box.ID);
  42.       ViewState["myControlList"] = myControlList;
  43.    }
  44. }
May 16 '08 #1
0 913

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

Similar topics

2
1917
by: JC | last post by:
Greetings all. I would like to know how to make a textboxs height = the height of the cell it's in minus 10 px or what ever number.. Using 90% for height does not work as I need it to be exactly so many px less than the total height and with %'s it's too dynamic from small to large screens. Thanks for any help! Jeff
1
1105
by: Lily | last post by:
Hi there, I have 10 textboxs on a page. When tab into a textbox, the entire text ($0.00) in a textbox is selected in blue. How do I have this effect by single clicking on the textbox?
2
2929
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have a WebForm with some textboxes, dropdownlists, a panel, imagebutton and so on. When I click on the image button (which was created at design time) I dynamically build a table. In each of row of that new table I put several cells and one cell...
7
1737
by: MariusI | last post by:
Are objects implicitly stored in the TLS of the currently running thread? When creating multithreaded applications i get errors when accessing data from a different thread than the thread used to create the objects (which is easely fixed by calling Invoke()). Also, is there a way to acces the thread which created the thread, or in other words: is there a parent/child relationship between threads?
9
7129
by: Tushar | last post by:
Followup-To: microsoft.public.dotnet.general Does anyone know when is this event raised, is it: 1) When the file is created but may not have been closed 2) When the file is created AND it has been closed I am using this control in a Windows-Service I've developed. It works hoever the problem I'm having is that the file does not seem to be available when I receive this event. If I include a delay of a few seconds using Sleep(3000) for...
3
1615
by: Happy Man | last post by:
Why we created All praise is due to Allah and may His peace and blessings be upon his last messenger (saaw) and on all those who follow the path of righteousness until the last day. We have to answer the most fundamental question that every human being asks himself at some point in his or her lifetime. Not just Muslims, but every single human being.
2
1352
by: kethireddy | last post by:
Hi .This is Aruna..Am working on ASP...Now am facing on a problem.. In the asp form i took 5 textboxs and one search button...when a write record name in a last textbox from database and click search button.then show all row vales display in remaing textboxs....SO can u suggest how to do that... we we search a row name from database into form...then display remaining row values...Is it possible!
4
1684
by: ganesh22 | last post by:
Hi, How to Create textboxs using JavaScript in asp.net/c# and how to assign that values to a string?
17
2716
by: shivasusan | last post by:
Hi! In my program, I have multiple check boxs.(more the 10) But i give rights to select 2 check boxs, If i select more then 2 check boxs, I want to display alert message. Please any one post me modle program. Please very very urgent.... any only help me... By Susan.
0
9497
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
10363
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
10164
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7515
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
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.