TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
prasanna shah
NA
37
94.6k
creating textbox at runtime
May 2 2011 3:21 PM
how to create textboxes at runtime on button click. As many time as the button is clicked and the value of textbox is to be passed to next page through session.
i have such code so far
protected void btnadd_Click(object sender, EventArgs e)
{
var i = 1;
for (i = 1; i <= count+1; i++)
{
TextBox txt = new TextBox();
form1.Controls.Add(txt);
txt.ID = "r" + count;
txt.Text = txt.ID;
}
}
Here i want to give the ID to all the textbox that will be created at runtime.This code displays textbox only once when the button is clicked. But i want to display textbox everytime when the button is clicked.
If do this
protected void btnadd_Click(object sender, EventArgs e)
{
var i = 1;
for (i = 1; i <= 5; i++)
{
TextBox txt = new TextBox();
form1.Controls.Add(txt);
txt.ID = "r" + count;
txt.Text = txt.ID;
count++;
}
}
there displays 5 textbox with id of textbox like ro,r1,r2,r3,r4.
please help me. I have been working on this for many days.
thanks in advance
prasanna
Reply
Answers (
2
)
How to set images in Background in Crystal Report in Asp.net?
Automatic Email&SMS Scheduling thru windows service