List Box Selected.value throwing null exception

mbc2002

New Member
Populated list box like this:\[code\]if (ds != null){ ListPreviousRecords.Items.Clear(); ListPreviousRecords.DataSource = ds; ListPreviousRecords.DataTextField = "Date"; ListPreviousRecords.DataValueField = "ID"; ListPreviousRecords.DataBind();}\[/code\]Get selected value:\[code\]protected void ListPreviousRecords_OnSelectedIndexChanged(object sender, EventArgs e){ if(ListPreviousRecords.SelectedItem.Value != "") { int mySelectedValue = http://stackoverflow.com/questions/15497199/int.Parse(ListPreviousRecords.SelectedItem.Value);// throwing null exception loadPreviousDetails(mySelectedValue); }}\[/code\]
 
Back
Top