hi,
how to bind a string to listbox such a way that after ',' string should be displayed on new line and at the center of the list box
Eg:
AAA,BBB,CCC,DDD
AAA,
BBB,
CCC,
DDD
Code:
here addressDetailItem is list object
if (addressDetailItem != null)
{
lstAddressResult.DataSource = addressDetailItem;
lstAddressResult.DisplayMember = "Title";
lstAddressResult.ValueMember = "Detail";
}
Loading

Khan Abrar AhmedRank #778 · 3K reputationPosted Apr 13, 2014, 10:29 PM EDT
you can split the string and add in the array and bind the array to listItem.
ex.
string value=AAA,BBBB,CCCC,DDDD
string[] abc = value.split(',');
if (abc != null)
{
lstAddressResult.DataSource = abc ;
lstAddressResult.DisplayMember = "Title";
lstAddressResult.ValueMember = "Detail";
lstAddressResult.databind();
}
Varsha B83 reputationPosted Apr 13, 2014, 10:41 PM EDT
if (addressDetailItem != null)
{
lstAddressResult.DataSource = addressDetailItem;
lstAddressResult.DisplayMember = "Title";
lstAddressResult.ValueMember = "Detail";
}
Khan Abrar AhmedRank #778 · 3K reputationPosted Apr 14, 2014, 2:37 AM EDT
can you please post the full code or what error you are getting.
VulpesRank #55 · 29.2K reputationPosted Apr 14, 2014, 6:13 AM EDT