1.call method
string PagesNames2 = Convert.ToString( ReturnArrayList(PagesNamesExist));
2.Here is the menthod that adds line break after 5 items
int cnt = 0;
int warrantIDInt = 0;
public StringBuilder ReturnArrayList(StringBuilder sb)
{
StringBuilder warrantId = new StringBuilder();
ArrayList warrantIDList = new ArrayList();
string[] ArryayPageId = sb.ToString().Split(',');
if (ArryayPageId.Length > 1)
{
foreach (string id in ArryayPageId)
{
warrantIDList.Add(id);
}
}
if (warrantIDList.Count > 5)
{
for (int i = 0; i < warrantIDList.Count; i++)
{
string warrantIDStr = warrantIDList[i].ToString();
warrantId.Append(warrantIDStr + ",");
cnt++;
if (cnt > 5)
{
warrantId.Append("<br/>");
cnt = 0;
}
}
}
else
{
for (int i = 0; i < warrantIDList.Count; i++)
{
string warrantIDStr = warrantIDList[i].ToString();
warrantId.Append(warrantIDStr + ",");
}
}
return warrantId;
}
No comments:
Post a Comment