Shorten/Camouflage very large text within a grid

Asked

Viewed 118 times

0

I have this grid line that takes the description of a message, but it is very large sometimes and is breaking the grid layout, I wonder if it is possible to shorten the message and/ or camouflage the message in link.

That is to take the message and replace with a Visualise

Follows code:

<asp:TemplateField HeaderText="ÚLTIMA MENSAGEM">
      <ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
     <a href="cicloObjetivo.aspx?Cod=<%# Eval("OcIDescr")%>" style="color: #0000FF;">
          <%# Eval("OcIDescr").ToString()%>'</a>
 </ItemTemplate>
   </asp:TemplateField>

Grid: inserir a descrição da imagem aqui

  • inside Itemstyle, adds the size you want in the column: <ItemStyle HorizontalAlign="Center" Width="50px" />

1 answer

1


A suggestion for you:

  • In the class you own the description property (Ocidescr) you can add a new property that would be the short description, when the user click on it you would open a modal showing the full text.

    public string OcIDescrResumida
    {
        get
        {
            return !string.isNullOrWhiteSpace(OcIDescr) ? OcIDescr.Substring(0, 20) + "..." : string.empty
        }
    }
    

Don’t forget to replace your code snippet to use this new property.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.