Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 08, 2012 02:59 AM by breaker14
Jun 08, 2012 01:50 AM|LINK
Conversion from string "" to type 'Integer' is not valid this is my problem when
i execute or debug the program my cblType.SelectedValue (this is a checkbox) it pop up
"Conversion from string "" to type 'Integer' is not valid" (error) ... in my design for Checkbox it has an ITEM "ABC" for text and it has a value of 2
sample item ABC value 2
CBD value 3..
Jun 08, 2012 02:03 AM|LINK
First of all Share code.. always..
Jun 08, 2012 02:37 AM|LINK
cblType.SelectedItem.Value.Tostring() instead of cblType.SelectedValue
Jun 08, 2012 02:56 AM|LINK
For a CheckBoxList, you cannot just use cblType.SelectedValue or cblType.SelectedItem.Value to get all the selected values. Not too sure if this is the best however I always loop through the items collection and get the checked value, for example:
(assumming you have a Literal called ltResult in your page and a Button
btnTest for testing the result)
protected void btnTest_Click(object sender, EventArgs e)
var selectedValues = new List<string>();
foreach (ListItem c in cblType.Items)
if (selectedValues.Count > 0)
ltResult.Text = string.Join(",", selectedValues.ToArray());
Jun 08, 2012 02:59 AM|LINK
thank you i resolved already..