会话控制和数据 [英] Session Control and Data

查看:91
本文介绍了会话控制和数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个针对不同用户的会话,当他们登录网站时.当他们单击表单时,我进行了一个会话,该会话将使用其用户ID,并将其应用于表单以填充用户数据.我现在想要做的是使会话仍在进行中,但不显示代码中的字段.我想显示其他所有内容,但不显示要经过的会话的用户名.有可能吗?

I have a session that is in place for different users when they log into the website. When they click on the form I have a session that takes their userid and apply it to the form for the user data to get filled. What I want to do now is to have the session still in progress but not to display the field that I have in the code. I want to display everything else but not the userid that I have to session to go by. Is that possible?

protected void Page_Load(object sender, EventArgs e)
    {
        ButtonPrint.Attributes.Add("onclick", "window.print(); return false");

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

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

        TextBoxINST_ID.Text = Session["inst_id"].ToString();
        SqlCommand scmd = new SqlCommand("Select INST_ID, LongName from TableCOCINST where INST_ID = '" + TextBoxINST_ID.Text + "'", con);
        SqlCommand scmd2 = new SqlCommand("Select INST_ID, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, SCHOLARSHI, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP, TOTASSETS, TOTLIABILITY, NoNEXPPERMRESASSETS, UNRNETASSETS, TOTALREV, TUITFEES, CURRDEBT, LONGTERMDEBT from TableFIN2012 where INST_ID = '" + TextBoxINST_ID.Text + "'", con2);
        SqlDataReader dr = scmd.ExecuteReader();
        SqlDataReader dr2 = scmd2.ExecuteReader();

        if (dr.Read())
        if (dr2.Read())
            {
                TextBoxSchool.Text = dr["LongName"].ToString();
                TextBoxLYInstr.Text = dr2["INSTRUCTIO"].ToString();
                TextBoxLYRes.Text = dr2["RESEARCH"].ToString();
                TextBoxLYPubS.Text = dr2["PUBLIC_SER"].ToString();
                TextBoxLYAcad.Text = dr2["ACADEMIC_S"].ToString();
                TextBoxLYStudS.Text = dr2["STUDENT_SE"].ToString();
                TextBoxLYInstiS.Text = dr2["INSTITUTIO"].ToString();
                TextBoxLYOperM.Text = dr2["PHYSICAL_P"].ToString();
                TextBoxLYSFEDA.Text = dr2["SCHOLARSHI"].ToString();
                TextBoxLYAuxE.Text = dr2["AUXILIARY_"].ToString();
                TextBoxLYHosS.Text = dr2["HOSPITALS"].ToString();
                TextBoxLYIndeO.Text = dr2["INDEPENDEN"].ToString();
                TextBoxLYOED.Text = dr2["OTHEREXP"].ToString();
                TextBoxLYTA.Text = dr2["TOTASSETS"].ToString();
                TextBoxLYTL.Text = dr2["TOTLIABILITY"].ToString();
                TextBoxLYNPRNA.Text = dr2["NoNEXPPERMRESASSETS"].ToString();
                TextBoxLYTUNA.Text = dr2["UNRNETASSETS"].ToString();
                TextBoxLYTR.Text = dr2["TOTALREV"].ToString();
                TextBoxLYTFN.Text = dr2["TUITFEES"].ToString();
                TextBoxLYCD.Text = dr2["CURRDEBT"].ToString();
                TextBoxLYLTD.Text = dr2["LONGTERMDEBT"].ToString();
                

            }
        dr.Close();
        con.Close();
        dr2.Close();
        con2.Close();

    }

推荐答案

这就是我解决问题的方法.
就我而言,我有一个显示用户ID的文本框.我转到了文本框属性,单击下拉菜单中的可见",并将其设置为假".保存表单并在浏览器中查看,文本框不见了.表单仍然可以正常工作.
This is how I solve my issue.
In my case I had a textbox that displayed the userid. I went to the textbox properties, clicked down the drop down for Visible and set it to False. Saved the form and viewed it in browser and the textbox was gone. The form still works fine.


这篇关于会话控制和数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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