Code behind ‘define public var Protected StartDate As String Protected EndDate As String ‘define other var Dim sDate = Request.Form(“startDateTbx”) Dim eDate = Request.Form(“endDateTbx”) Dim r As Regex r = New Regex(“^(0[1-9]|[1-9]|1[012])/(0[1-9]|[1-9]|[12][0-9]|3[01])/20\d\d$”) ‘run validation If sDate = “” Then startDateLbl.Text = “Required” ElseIf Not r.Match(sDate).Success Then startDateLbl.Text = “Invalid date. Use mm/dd/yyyy.” Else startDateLbl.Text = […]
Archive for January, 2013
Captcha – VB.NET
Email form <tr> <td></td> <td></td> </tr> <tr> <td></td> <td><img style=”WIDTH: 119px; HEIGHT: 34px” alt=”” src=”Captcha.aspx” /> <a href=””>Can’t Read?</a></td> </tr> <tr> <td></td> <td><asp:textbox runat=”server” ID=”txtcaptcha”></asp:textbox></td> </tr> <tr> <td></td> <asp:ImageButton ID=”ContactSeller” CausesValidation=”True” runat=”server” ImageURL=”/images/buttons/btn_submit.gif” /></td> </tr> Email page code behind …. Dim captchaStr As String = Session(“randomStr”) Dim captchaTxt As TextBox = ContactSeller.FindControl(“txtcaptcha”) If captchaStr captchaTxt.Text.ToString […]
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) […]