ASP.Net/Mobile Control/Required Field Validator

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Mobile required field validator (VB.net)

<%@ Page 
    Inherits="System.Web.UI.MobileControls.MobilePage" 
    Language="VB" 
%>
<%@ Register 
    TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" 
%>
<script runat="server" language="VB">
Sub OK_OnSubmit(Sender As Object, E As EventArgs)
    If Page.IsValid Then
        ActiveForm = FinishForm
        lbl2.Text = "You entered " & txt1.Text 
    End If
End Sub
</script>
<mobile:form 
    id="StartForm" 
    runat="server">
    <mobile:label 
        runat="server" 
        id="lbl1"
        Text="Enter something:" 
    />
    <mobile:textbox
        runat="server" 
        id="txt1"
    />
    <mobile:requiredfieldvalidator 
        id="rfv1" 
        controltovalidate="txt1" 
        runat="server"
        errormessage="This field is required!!!"
    />
    <mobile:Command 
        runat="server" 
        id="cmdOK"
        OnClick="OK_OnSubmit" 
        Text="OK" 
    />
</mobile:form>
<mobile:form 
    id="FinishForm" 
    runat="server">
    <mobile:label 
        runat="server" 
        id="lbl2"
    />
</mobile:form>