Home » Posts tagged "Count"

Archive for the 'Count' Tag

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) […]

Content Limited by Character Number – VB.NET

Code behind Partial Class _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 ‘character count If DataBinder.Eval(e.Row.DataItem, “description”).ToString.Length >= 175 Then e.Row.Cells(3).Text = + DataBinder.Eval(e.Row.DataItem, “description”).ToString.Substring(0, 175) + e.Row.Cells(3).ToolTip = DataBinder.Eval(e.Row.DataItem, “description”).ToString Else e.Row.Cells(3).Text = + DataBinder.Eval(e.Row.DataItem, “description”).ToString End If End If End Sub End Class

Record Count Using Stored Procedure

Imports System.Data.SqlClient Partial Class mb_app_promo Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles Me.Load G1.Text = “500” Dim connString As String connString = ConfigurationManager.ConnectionStrings(“myConnString”).ToString Dim conn As New SqlConnection(connString) Try conn.Open() Dim cmd As New SqlCommand(“myStoredProcedure”, conn) Dim count As Integer = CInt(cmd.ExecuteScalar()) If count >= 500 Then Goal1.Text […]