I have a listBox that is presenting a list of string values in a UI.
These string values are presented like -
value|1
value|2
value|3
//etc
Where the integer value is the string ID stored in the database.
I have used a split function on the next page '|' to get the string and ID when its passed through for other methods.
Is there anyway I can hide the ID value in the UI however still have it present in the listBox so it is available on the query string?
The listBox is populated like this -
foreach (string x in values)
{
ListBox3.Items.Add(x); // I want to hide the '|1' value in the listBox
}
EDIT I want to hide the ID of the value however have it available in the query string as the split function is happening on the next page. On original page there is a button like so -
protected void Button6_Click(object sender, EventArgs e) {
if (ListBox3.SelectedItem != null)
{
Response.Redirect("About.aspx?term=" + ListBox3.SelectedItem);
}
}
Where ListBox3.SelectedItem is value|1 then on the next page I am splitting this. So I need this full sting to pass on the query string however only want the value part visible in the listBox.