1. This method used to split string and add suffix like " ........."
   lnkTitle.Text = FormatText(lnkTitle.Text.Trim(
   lblOwner.Text = FormatText(lblOwner.Text.Trim(
    public string FormatText(string text, int len, string suffix)
        {
            if (len != -1 && text.Length > len)
            {
                int pos = text.LastIndexOfAny(" ,.".ToCharArray(), len);
                if (pos == -1)
                    pos = len;
                text = text.Substring(0, pos) + suffix;
            }
            return text;
        }
Out Put : like this launch new soon ...
2. This method used to return the Date Time in formatted .
 public string DateFormat(string date)
{
string datereturn = string.Empty;
try
{
if (!string.IsNullOrEmpty(date))
{
string format = "dd MMMM yyyy";
{
string datereturn = string.Empty;
try
{
if (!string.IsNullOrEmpty(date))
{
string format = "dd MMMM yyyy";
                    datereturn = Convert.ToDateTime(date).ToString(format);
}
}
catch (Exception)
{
}
return datereturn;
}
}
}
catch (Exception)
{
}
return datereturn;
}
 
No comments:
Post a Comment