• textbox填入后验证输入的合法或根据输入的内容失去焦点后立即得出其他信息


     <x:SimpleForm ID="SimpleForm1" runat="server" EnableBackgroundColor="true" ShowBorder="False"
                                    BodyPadding="2px" ShowHeader="False">
                                    <Items>
                                        <x:Panel ID="Panel3" ShowHeader="false" ShowBorder="false" EnableBackgroundColor="true"
                                            BodyPadding="2px" Layout="Column" runat="server">
                                            <Items>
                                            <x:Label ID="Label14" Width="90px" runat="server" ShowLabel="false" Text="教工号:" EncodeText="false"
                                                    CssClass="inline" ShowRedStar="true" >
                                                </x:Label>
                                                <x:TextBox ID="txtEmployeeNumber" runat="server" CssClass="mright" Required="true"
                                                    Width="200px" AutoPostBack="true" OnTextChanged="textChanged_Click">
                                                </x:TextBox>
                                                <x:Label ID="Label2" Width="90px" runat="server" ShowLabel="false" Text="姓名:" EncodeText="false"
                                                    CssClass="inline" ShowRedStar="true">
                                                </x:Label>
                                                <x:TextBox ID="txtName" runat="server" CssClass="mright" Required="true"
                                                    Width="200px">
                                                </x:TextBox>
                                                    </Items>
                                        </x:Panel>
                                       <x:Panel ID="Panel4" ShowHeader="false" ShowBorder="false" EnableBackgroundColor="true"
                                            BodyPadding="2px" Layout="Column" runat="server">
                                            <Items>
                                                <x:Label ID="Label6" Width="90px" runat="server" ShowLabel="false" Text="&nbsp性别:" EncodeText="false"
                                                    CssClass="inline" ShowRedStar="true">
                                                </x:Label>
                                                <x:RadioButton ID="rbtnNan" GroupName="MyRadioGroup1" Label=" " LabelSeparator="" Checked="true"
                                                    Width="105px" Text="男" runat="server">
                                                </x:RadioButton>
                                                <x:RadioButton ID="rbtnNv" GroupName="MyRadioGroup1" Label=" " LabelSeparator=""
                                                    Width="105px" Text="女" runat="server">
                                                </x:RadioButton>
                                                <x:Label ID="Label3" Width="90px" runat="server" ShowLabel="false" Text="出生日期:" EncodeText="false"
                                                    CssClass="inline" ShowRedStar="true">
                                                </x:Label>
                                                <x:DatePicker ID="txtBirthday" runat="server" DateFormatString="yyyy-MM-dd"  Required="true"
                                                    Width="200px">
                                                </x:DatePicker>
                                            </Items>
                                        </x:Panel>
                                        
                                        <x:Panel ID="Panel5" ShowHeader="false" ShowBorder="false" EnableBackgroundColor="true"  BodyPadding="2px"
                                            Layout="Column" runat="server">
                                            <Items>
                                                <x:Label ID="Label7" Width="90px" runat="server" ShowLabel="false" Text="身份证:" EncodeText="false"
                                                    CssClass="inline" ShowRedStar="true">
                                                </x:Label>
                                                <x:TextBox ID="txtIDCard" runat="server" CssClass="mright" Required="true" Width="200px" EmptyText="请输入18位的身份证号" RegexPattern="IDENTITY_CARD" RegexMessage="请输入正确的18位身份证号码" >
                                                </x:TextBox>
                                                <x:Label ID="Label9" Width="90px" runat="server" ShowLabel="false" Text="部门:" EncodeText="false"
                                                    CssClass="inline" ShowRedStar="true">
                                                </x:Label>
                                                <x:TextBox ID="txtPart" runat="server" CssClass="mright" Required="true"
                                                    Width="200px">
                                                </x:TextBox>
                                               
                                            </Items>
                                        </x:Panel>
                                    </Items>
                                </x:SimpleForm>
                            </Items>
                        </x:GroupPanel>
    

      根据输入的教工号填入后立即得出其他的信息,注意教工号txtEmployeeNumber控件后的

    OnTextChanged="textChanged_Click"
    后台代码:
      protected void textChanged_Click(object sender, EventArgs e)
            {
                if (txtEmployeeNumber.Text.Trim() != "")
                {
                    employeeBLL.GetEmployeeInfoByEmployeeNumber(txtEmployeeNumber.Text.Trim());
                    if (employeeBLL.GetEmployeeInfoByEmployeeNumber(txtEmployeeNumber.Text.Trim()) == null)
                    {
                        Alert.Show("对不起,你的信息还没有填入教师信息表,请联系管理员!", MessageBoxIcon.Error);
                    }
                    else
                    {
                        txtName.Text = employeeBLL.GetEmployeeInfoByEmployeeNumber(txtEmployeeNumber.Text.Trim()).Name;
                        txtPart.Text = employeeBLL.GetEmployeeInfoByEmployeeNumber(txtEmployeeNumber.Text.Trim()).Part;
                        txtIDCard.Text = employeeBLL.GetEmployeeInfoByEmployeeNumber(txtEmployeeNumber.Text.Trim()).IDcard;
                        txtBirthday.Text = employeeBLL.GetEmployeeInfoByEmployeeNumber(txtEmployeeNumber.Text.Trim()).Birthday.ToString("yyyy-MM-dd");
    
    
                    }
    
                }
            }
    

      

  • 相关阅读:
    自动释放池
    图片裁剪成圆形(无边框)
    根据数字对应星期几
    IOS 周几转化数字
    计算两个日期之间的天数
    java——IO流整理(一)
    java——File类的用法整理
    java——用递归和IO流来实现文件的复制
    java——java集合详解
    java——对象的克隆
  • 原文地址:https://www.cnblogs.com/fang645421992/p/3829915.html
Copyright © 2020-2023  润新知