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
vignesh t
NA
63
20.3k
Unable to get values of dynamically created controls c#
Jan 8 2018 2:33 AM
I have created dynamic controls on button click and I'm not able to retrieve values of dynamically created controls. I am getting values of dynamic controls inside a panel.
pnlDepartment is the Panel ID.
protected
void
btnValues_Click(
object
sender, EventArgs e)
{
string
strDDLValue =
string
.Empty;
foreach
(DropDownList ddl
in
pnlDepartment.Controls.OfType<DropDownList>())
{
strDDLValue = ddlName.SelectedItem.Text +
","
+ ddlLocation.SelectedItem.Text;
}
}
The strDDLValue has only first dropdown values and when it loops for the second time it still takes the first dropdown values and unable to get dynamic control values.
Please correct me if I'm making a mistake somewhere.
Reply
Answers (
2
)
Move email to folder
CrystalReportsException: Load report failed