Showing posts with label Input. Show all posts
Showing posts with label Input. Show all posts

Wednesday, 4 January 2012

Validate Email using RegEx

Dim regex As New
System.Text.RegularExpressions.Regex("^[\w-\.]+@([\w-]+\.)+[\w-]{2,3}$")
Dim match As System.Text.RegularExpressions.Match
match = regex.Match(myEmail)

If Not match.Success Then
ErrorMsg = ErrorMsg & "Email Not Valid"
End If

Friday, 28 October 2011

Javascript to disable all ASP:ImageButton

if you want to disable all <ASP:ImageButton type controls using Javascript, you have to keep in mind that browser renders the controls this way

<input type="image" name="ctl00$btnUserHistory" id="btnUserHistory" title="User Activities" src="/Img/userhistory.gif" />

You see ctl00$ in the name as the button is inside a ContentPlaceHolder, so catch all inside or not write this function

function disableButton() {
        //Disable All Image Buttons       
        var ButtonsColl = document.getElementsByTagName('input');
        for (i = 0; i <= ButtonsColl.length - 1; i++) {
            if (ButtonsColl[i].getAttribute('type') == 'image') {
                ButtonsColl[i].disabled = true;
            }
        }
    }