473,473 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Create 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 893

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

Similar topics

2
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...
1
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
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...
7
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...
9
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...
3
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...
2
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...
4
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
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...
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
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...
1
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
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,...
1
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.