Home » 2013 » January » 05

Archive for January 5, 2013

Content Limited by Word Count – VB.NET

Imports System.Text.RegularExpressions Partial Class for_sale_Default Inherits System.Web.UI.Page Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then Dim WordCountInt As Integer = CountWords(DataBinder.Eval(e.Row.DataItem, “description”).ToString) Dim WordCountStr As String = DataBinder.Eval(e.Row.DataItem, “description”).ToString If WordCountInt >= 40 Then Dim iNextSpace As Integer = WordCountStr.LastIndexOf(” “, 175) e.Row.Cells(3).Text = + DataBinder.Eval(e.Row.DataItem, “description”).ToString.Substring(0, iNextSpace) […]