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
babyson priyavardhan
NA
16
10k
saving dynamically created textbox values using "for loop"
Dec 17 2014 2:32 AM
hi,
I have created a dynamic textbox using "for loop".i am unable to retrive the data from dynamically created textbox using for loop.Please find the code below to create dynamically created textbox and to retrive data.Please help to solve the problem.
Used ajax to stop the fullpage postback.
//Generate textbox
protected void button1_click(object sender,EventArgs e)
{
int count=Convert.ToInt32(txtbox.Text);
for(int i=0;i<count;i++)
{
TextBox tb=new TextBox();
tb.ID="txtser"+i.ToString();
panel1.Controls.Add(tb);
}
}
// Retrive value
protected void button2_click(object sender,EventArgs e)
{
int c=Convert.ToInt32(txtbox.Text);
for(int j=0;j<c;j++)
{
TextBox t=(TextBox)(panel1.FindConrols("txtser"+i.ToString()));
Label1.Text=t.Text;
}
}
Reply
Answers (
6
)
Regex 17122014
How to Insert Data.when textboxes are generated dynamically