码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-07-09 21:35:38      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:blog   color   width   os   art   for   

 <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");


                }

            }
        }

  

textbox填入后验证输入的合法或根据输入的内容失去焦点后立即得出其他信息,布布扣,bubuko.com

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

标签:blog   color   width   os   art   for   

原文地址:http://www.cnblogs.com/fang645421992/p/3829915.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!