title: Binding Listbox value and Text in c# in aspx
body: <p>I have a ListBox and want to bind value and text to it.</p>
  
  <p>The Value and Text are taken from query string and they are comma separated.</p>
  
  <p>My code goes as follows:</p>
  
  <pre><code>var pIDs = Request.QueryString["pIds"];
  var pIDsText = Request.QueryString["pText"];
  var SeparatedIds = pIDs.Split(',').Distinct().ToArray();
  var SeparatedPIdsText = pIDsText.Split(',').Distinct().ToArray();
  
  System.Web.UI.WebControls.ListBox ls = (System.Web.UI.WebControls.ListBox)User_Control_ListBox1.FindControl("lstShowPrograms");
  
   for (int i = 0; i &lt; SeparatedPIdsText.Length; i++)
   {
        if (!string.IsNullOrEmpty(SeparatedPIdsText[i])) 
            {
  
                  ls.Items.Add(SeparatedPIdsText[i]);
            }
  
   }
  </code></pre>
  
  <p>The above code is adding only text.I want to set both value and text.
  Text to display and value(ID) for background.</p>