• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

ASP html need to trim value

I have a form hat produces checkboxes dynamically. The values though are too long. How do  
just get it to display the first 40 charatacters.

here is my code:

%>
<tr><td><input type=checkbox name=build <%=strSelected%> value="<%=objRS("cis")%>"></td>
<td><%=objRS("cis")%></td>
</tr>
<%
0
tmurray22
Asked:
tmurray22
  • 2
1 Solution
 
Ryan ChongCommented:
maybe..

cis = left("" & objRS("cis"), 40)
%>
<tr><td><input type=checkbox name=build <%=strSelected%> value="<%=cis%>"></td>
<td><%=objRS("cis")%></td>
</tr>
<%
0
 
Ryan ChongCommented:
oops, that isn't good, try this instead:

if len("" & objRS("cis"))> 40 then
   cis = left("" & objRS("cis"), 40) &"..."
else
  cis = "" & objRS("cis")
end if
%>
<tr><td><input type=checkbox name=build <%=strSelected%> value="<%=objRS("cis")%>"></td>
<td><%=cis%></td>
</tr>
<%
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now