Hi,
I have faced some issue with my code. I want to show only 10 characters from my string.
Here is my code.
<span style="font-size: medium">
@if (item.Name.Length > 10)
{
@item.Name.ToString(); // Here i want to show only 10 characters.
}
else
{
@item.Name.ToString();
}
</span>
Please give me some idea to accomplish my task.
Hemant Patel
15-Dec-2017Hi Aaditri,
I analyzed your code. You can use SubString() method and passed initially to max length in SubString() method to get only 10 characters.
Please follow below a modified line of code to accomplish your task.
Hope its helpful ..!!