• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

Selected value of a List box not populating in stored procedure

hello experts I have a listbox named LBFactSupNew and it is dynamically populated by this stored procedure listed below. now when I try to save the information to the data base while debugging line by line the selected value of the list box is comming up "" can some one tell me what the hell I am doing wrong???

   private void PopulateNewFactSuper()
        {
            SqlConnection con = new SqlConnection(Settings.GetConfigValue("PARK_IRB_V1_11_19_2010", "IRB2010ConnectionString"));
            con.Open();
            SqlCommand cmd = new SqlCommand("P_sp_PopulateNewFactSup", con);
            SqlDataReader r = cmd.ExecuteReader();
            DataTable dt = new DataTable();
            LBFactSupNew.Items.Clear();
            while (r.Read())
            {
                ListItem i = new ListItem(r["truename"].ToString().Trim(), r["ParkID"].ToString().Trim());
                LBFactSupNew.Items.Add(i);
            }
            con.Close();
   
       
        }
0
HawaiiDragon
Asked:
HawaiiDragon
1 Solution
 
Molly FaganApplications Team SupervisorCommented:
What method are you using to get the selected value?  In VB.NET it would be:

LBFactSupNew.SelectedItem.ToString()
0
 
informaniacCommented:
Where have u called PopulateNewFactSuper.

Add this.

if(!isPostBack)
PopulateNewFactSuper()
0
 
HawaiiDragonAuthor Commented:
thank you!!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now