Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
Unable to get values of dynamically created controls c#
vignesh t
Jan 8 2018 2:33 AM
112
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Move email to folder
CrystalReportsException: Load report failed