Reputation: 98
I am trying to use the following code
update_facility_shift_duration.SelectedIndex = Int32.Parse(reader_facility["facility_shift_duration_id"].ToString()); //If this is current user's facility add select
update_facility_shift_duration
is the ID for the <selected>
which gets its value by the following code
update_facility_shift_duration.Items.Add(new ListItem(result, reader_facility["facility_shift_duration_id"].ToString()));
I have about 6 select options and want to select the one that matches the ID in the database .
But I am getting the following error. Does anyone know how to solve this or might have some idea to push me in the right direction? Thanks in advance
Upvotes: 1
Views: 328
Reputation: 604
reader_facility["facility_shift_duration_id"] is probably null. Check it is null or empty.
Upvotes: 1