We help IT Professionals succeed at work.
Get Started

How can I display only part of data in the repeater control column?

397 Views
Last Modified: 2012-05-11
I have repeater control which I am binding directly to my datatable, to display data in column.
-----------------------------
ASPX page
----------------------------------
<asp:Repeater ID="Repeater1" runat="server">
      <HeaderTemplate>
      <table>
      <tr>
      <td>NAME</td>
      <td>DESCRIPTION</td>
      </tr>      
      </HeaderTemplate>
      <ItemTemplate>
      <tr>
      <td>
      <%# DataBinder.Eval(Container.DataItem, "NAME")%>
      </td>
      </tr>      
      <tr>
      <td>
      <%# DataBinder.Eval(Container.DataItem, "DESCRIPTION")%>
      </td>
      </tr>      
      </ItemTemplate>
      <AlternatingItemTemplate>
      <tr>
      <td>
      <%# DataBinder.Eval(Container.DataItem, "NAME")%>
      </td>
      </tr>      
      <tr>
      <td>
      <%# DataBinder.Eval(Container.DataItem, "DESCRIPTION")%>
      </td>
      </tr>      
      </AlternatingItemTemplate>
      <FooterTemplate>
      </table>
      </FooterTemplate>
      </asp:Repeater>
----------------------------------
ASPX.VB page
-------------------------------------
If ds.Tables(0).Rows.Count > 0 Then
      Repeater1.DataSource = ds
Repeater1.DataBind()
            End If
            myDS.Dispose()
----------------------------------------
In DESCRIPTION the data is really long. Ex:'1-1-1-this is example-123456-d-d.................'.
I do not want to display all of it.
Is there a way I can display only "this is example-123456" when I bind the column to the repeater?
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE