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

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 863

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
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=()=>{
2
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...
2
isladogs
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...
0
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...
0
tracyyun
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...
1
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...
3
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...
0
isladogs
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...
2
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.