如何屏蔽从数据库填充的文本框? [英] How to mask a textbox that is populated from a database?

查看:96
本文介绍了如何屏蔽从数据库填充的文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web表单,其中包含21个文本框,这些文本框中填充了数据库中的数据。我为这些文本框设置了一个屏蔽,当我调试它时,屏蔽不起作用。我忘记了什么吗?屏蔽适用于您必须输入数据而不是填充数据的其他文本框。请帮忙。谢谢。



这是屏蔽代码:



I have a web form that has 21 textboxes that are populated with data from a database. I set a masking to these textboxes and when I debug it the masking does not work. Am I forgetting something? The masking works for the other textboxes that you would have to enter data but not the populated ones. Please help. Thanks.

Here is the masking code:

<script src="Scripts/jquery-2.1.1.min.js" type="text/javascript"></script>
    <script src="Scripts/jquery.maskMoney.js" type="text/javascript"></script>
    <script type='text/javascript'>
        $(document).ready(function () {
            $("#TextBoxLYTROA").maskMoney();
            $("#TextBoxLYInstr").maskMoney();
            $("#TextBoxRes").maskMoney();
            $("#TextBoxPubS").maskMoney();
            $("#TextBoxAcad").maskMoney();
            $("#TextBoxStudS").maskMoney();
            $("#TextBoxInstiS").maskMoney();
            $("#TextBoxOperM").maskMoney();
            $("#TextBoxAuxE").maskMoney();
            $("#TextBoxHosS").maskMoney();
            $("#TextBoxIndeO").maskMoney();
            $("#TextBoxOED").maskMoney();
            $("#TextBoxTA").maskMoney();
            $("#TextBoxTL").maskMoney();
            $("#TextBoxTUNA").maskMoney();
            $("#TextBoxETRNA").maskMoney();
            $("#TextBoxNPRNA").maskMoney();
            $("#TextBoxTR").maskMoney();
            $("#TextBoxTFN").maskMoney();
            $("#TextBoxCD").maskMoney();
            $("#TextBoxLTD").maskMoney();  

        });
    </script>





这是我填写的代码:





Here is my populated code:

SqlConnection con4 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["HotConnectionString"].ConnectionString);
            con4.Open();

            SqlCommand scmd4 = new SqlCommand("Select INST_ID, TOTAL_REVE, DATE, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, SCHOLARSHI, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP, TOTASSETS, TOTLIABILITY, NoNEXPPERMRESASSETS, EXPENDABLE, UNRNETASSETS, TOTALREV, TUITFEES, CURRDEBT, LONGTERMDEBT, TOTALNETASSETS from Table3 where IUser_ID = '" + TextBoxIUser_ID.Text + "'", con4);
            SqlDataReader dr4 = scmd4.ExecuteReader();

            if (dr4.Read())
            {
                TextBoxLYTROA.Text = dr4["TOTAL_REVE"].ToString();
                TextBoxLYInstr.Text = dr4["INSTRUCTIO"].ToString();
                TextBoxLYRes.Text = dr4["RESEARCH"].ToString();
                TextBoxLYPubS.Text = dr4["PUBLIC_SER"].ToString();
                TextBoxLYAcad.Text = dr4["ACADEMIC_S"].ToString();
                TextBoxLYStudS.Text = dr4["STUDENT_SE"].ToString();
                TextBoxLYInstiS.Text = dr4["INSTITUTIO"].ToString();
                TextBoxLYOperM.Text = dr4["PHYSICAL_P"].ToString();
                TextBoxLYSFEDA.Text = dr4["SCHOLARSHI"].ToString();
                TextBoxLYAuxE.Text = dr4["AUXILIARY_"].ToString();
                TextBoxLYHosS.Text = dr4["HOSPITALS"].ToString();
                TextBoxLYIndeO.Text = dr4["INDEPENDEN"].ToString();
                TextBoxLYOED.Text = dr4["OTHEREXP"].ToString();
                TextBoxLYTA.Text = dr4["TOTASSETS"].ToString();
                TextBoxLYTL.Text = dr4["TOTLIABILITY"].ToString();
                TextBoxLYNPRNA.Text = dr4["NoNEXPPERMRESASSETS"].ToString();
                TextBoxLYETRNA.Text = dr4["EXPENDABLE"].ToString();
                TextBoxLYTUNA.Text = dr4["UNRNETASSETS"].ToString();
                TextBoxLYTR.Text = dr4["TOTALREV"].ToString();
                TextBoxLYTFN.Text = dr4["TUITFEES"].ToString();
                TextBoxLYCD.Text = dr4["CURRDEBT"].ToString();
                TextBoxLYLTD.Text = dr4["LONGTERMDEBT"].ToString();
                TextBoxLYTNA.Text = dr4["TOTALNETASSETS"].ToString();
            }
            con4.Close();
            dr4.Close();
        }
    }

推荐答案

document ).ready( function (){
(document).ready(function () {


< span class =code-string>#TextBoxLYTROA)。maskMoney();
("#TextBoxLYTROA").maskMoney();


< span class =code-string>#TextBoxLYInstr)。maskMoney();
("#TextBoxLYInstr").maskMoney();


这篇关于如何屏蔽从数据库填充的文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆