{"id":2419,"date":"2013-01-05T10:28:47","date_gmt":"2013-01-05T14:28:47","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=2419"},"modified":"2013-01-05T10:29:58","modified_gmt":"2013-01-05T14:29:58","slug":"content-limited-by-word-count-vb-net","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2013\/01\/content-limited-by-word-count-vb-net\/","title":{"rendered":"Content Limited by Word Count &#8211; VB.NET"},"content":{"rendered":"<pre>\r\n<code>\r\nImports System.Text.RegularExpressions\r\n\r\nPartial Class for_sale_Default\r\n    Inherits System.Web.UI.Page\r\n\r\nProtected Sub GridView1_RowDataBound(ByVal sender As Object, \r\n                                        ByVal e As GridViewRowEventArgs)\r\nIf e.Row.RowType = DataControlRowType.DataRow Then\r\n   Dim WordCountInt As Integer = CountWords(DataBinder.Eval(e.Row.DataItem, \r\n                                                               \"description\").ToString)\r\n   Dim WordCountStr As String = DataBinder.Eval(e.Row.DataItem, \"description\").ToString\r\n\r\n  If WordCountInt &gt;= 40 Then\r\n    Dim iNextSpace As Integer = WordCountStr.LastIndexOf(\" \", 175)\r\n    e.Row.Cells(3).Text = + \r\n    DataBinder.Eval(e.Row.DataItem, \"description\").ToString.Substring(0, iNextSpace) + \r\n    \" ... (&lt;a href='Description.aspx?cat=1&amp;aid=\" + \r\n    DataBinder.Eval(e.Row.DataItem, \"id\").ToString + \"' class='colorbox2'&gt;more&lt;\/a&gt;)\"\r\n     e.Row.Cells(3).ToolTip = DataBinder.Eval(e.Row.DataItem, \"description\").ToString\r\n  Else\r\n     e.Row.Cells(3).Text = + DataBinder.Eval(e.Row.DataItem, \"description\").ToString\r\n  End If\r\n End If\r\nEnd Sub\r\n    Public Function CountWords(ByVal value As String) As Integer\r\n        ' Count matches.\r\n        Dim collection As MatchCollection = Regex.Matches(value, \"\\S+\")\r\n        Return collection.Count\r\n    End Function\r\n\r\n\r\nEnd Class\r\n\r\n<\/code>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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, &#8220;description&#8221;).ToString) Dim WordCountStr As String = DataBinder.Eval(e.Row.DataItem, &#8220;description&#8221;).ToString If WordCountInt &gt;= 40 Then Dim iNextSpace As Integer = WordCountStr.LastIndexOf(&#8221; &#8220;, 175) e.Row.Cells(3).Text = + DataBinder.Eval(e.Row.DataItem, &#8220;description&#8221;).ToString.Substring(0, iNextSpace) [&hellip;]<\/p>\n","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85,17,16,84],"tags":[126,40,127],"class_list":["post-2419","post","type-post","status-publish","format-standard","hentry","category-net-4-0","category-applications","category-net","category-vs2010","tag-content","tag-count","tag-word"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2419"}],"collection":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/comments?post=2419"}],"version-history":[{"count":8,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2419\/revisions"}],"predecessor-version":[{"id":2428,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/2419\/revisions\/2428"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=2419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=2419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=2419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}