472,958 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

dynamilaccy created textboxs

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;
  3. public partial class _Default : System.Web.UI.Page
  4. {
  5.    int controlCounter = 0;
  6.    List<string> myControlList;
  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.    }
  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.    }
  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 863

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

Similar topics

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...
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?
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...
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...
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...
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...
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...
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?
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...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.