Was working on a project and we stumble with this error. Thanks in advance appreciate all the help
F Fort Respected Member Sep 30, 2013 #1 Was working on a project and we stumble with this error. Thanks in advance appreciate all the help Attachments 28sbss1.jpg 75.3 KB · Views: 35
Tommy Founder Sep 30, 2013 #2 Since SelectedValue doesn't really represent a string, you could try: Code: Int32.Parse(DropDownList1.SelectedValue.ToString()); Or, instead of using "int.Parse" you could use "int.TryParse": Code: int resultValue = 0; if ((int.TryParse(DropDownList1.SelectedValue, out result) && (resultValue > 0)) { // Do stuff }
Since SelectedValue doesn't really represent a string, you could try: Code: Int32.Parse(DropDownList1.SelectedValue.ToString()); Or, instead of using "int.Parse" you could use "int.TryParse": Code: int resultValue = 0; if ((int.TryParse(DropDownList1.SelectedValue, out result) && (resultValue > 0)) { // Do stuff }