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
VulpesPosted Apr 14, 2014, 10:13 AM
Khan Abrar AhmedPosted Apr 14, 2014, 6:37 AM
can you please post the full code or what error you are getting.
Varsha BPosted Apr 14, 2014, 2:41 AM
if (addressDetailItem != null)
{
lstAddressResult.DataSource = addressDetailItem;
lstAddressResult.DisplayMember = "Title";
lstAddressResult.ValueMember = "Detail";
}
Khan Abrar AhmedPosted Apr 14, 2014, 2:29 AM
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();
}