J
jimmy chao via .NET 247
Hi I am having problems with using the padright function in ASP.NET. my code is
string listring;
string strTitle = ds.Tables["QueryT"].Rows["Title"].ToString().Trim();
if (strTitle.Length > 15)
{
strTitle = strTitle.Remove(0,(strTitle.Length - 15));
}
else
{
strTitle = strTitle.PadRight(15, System.Convert.ToChar(" "));
}
liststring = strCallNo + " " + strTitle + strOpenDate + strCountry + strNotes + strStatusListItem listItem = new ListItem(liststring,ds.Tables["QueryT"].Rows _["Call#"].ToString());
THe thing is this code works if i place a "*" instead of a space but when u use a space it doesnt appear as desired in the listbox yet i check the string before being inserted into the listbox and it is padded i.e
16574 erwerw*********19 but spaces it displays
16754 erwerw19
Thanks in advance
jimmy
string listring;
string strTitle = ds.Tables["QueryT"].Rows["Title"].ToString().Trim();
if (strTitle.Length > 15)
{
strTitle = strTitle.Remove(0,(strTitle.Length - 15));
}
else
{
strTitle = strTitle.PadRight(15, System.Convert.ToChar(" "));
}
liststring = strCallNo + " " + strTitle + strOpenDate + strCountry + strNotes + strStatusListItem listItem = new ListItem(liststring,ds.Tables["QueryT"].Rows _["Call#"].ToString());
THe thing is this code works if i place a "*" instead of a space but when u use a space it doesnt appear as desired in the listbox yet i check the string before being inserted into the listbox and it is padded i.e
16574 erwerw*********19 but spaces it displays
16754 erwerw19
Thanks in advance
jimmy