Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Display 30 left crs from the databinder.eval

Posted on 2012-09-13
2
Medium Priority
?
672 Views
Last Modified: 2012-09-17
HOw do I display only the first 30 chrs of the ITemdescription field in the following: Is there a way to do a left or Right in HTML
  <td  width="60%" align="left">
                    <asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ItemDescription") %>'></asp:Label>
                </td>
0
Comment
Question by:TrialUser
2 Comments
 
LVL 13

Accepted Solution

by:
JonNorman earned 1000 total points
ID: 38398237
I'm not an ASP expert, but I think you are looking for:

<%# DataBinder.Eval(Container.DataItem, "ItemDescription").ToString().Substring(0, 30) %>
0
 
LVL 16

Assisted Solution

by:Rose Babu
Rose Babu earned 1000 total points
ID: 38401437
Hi,

you cal also try Left function in .net as mentioned in the below link

http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.strings.left%28v=VS.100%29.aspx

Sample code:

<asp:Label ID="Label2" runat="server" Text='<%# Left(DataBinder.Eval(Container.DataItem, "ItemDescription"), 30) %>'></asp:Label>

Or

try a small function that will truncate the word upto n characters and put some continuation dots.

Below is the link for this process.

http://www.mikesdotnetting.com/Article/137/Displaying-The-First-n-Characters-Of-Text

put the Chop() function in your code and use it.

Sample code :

<asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ItemDescription").ToString().Chop(30) %>'></asp:Label>

Hope these additional info may help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question