Hi,
I get confused between the property of drop down list,
not sure when to use either one, I run into issues when using ddl.SelectedItem.Value, but when I use ddl.SelectedValue it solve the problem and I am able to get the value.
Please advise
if (ddlOwner.SelectedItem.Value == "1") {
lblOutput.Text = "Please select Owner !";
lblOutput.ForeColor = System.Drawing.Color.Red;
ddlOwner.Focus();
return;
}
VS
if (ddlOwner.SelectedValue == "1") {
AllblOutput.Text = "Please select Owner !";
lblOutput.ForeColor = System.Drawing.Color.Red;
ddlOwner.Focus();
return;
}

Rajanikant HawaldarRank #110 · 20.3K reputationPosted Apr 5, 2020, 5:27 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 5, 2020, 6:19 AM EDT
Harsh ShahRank #1,322 · 1.3K reputationPosted Apr 7, 2020, 5:56 PM EDT