Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            TokenValidate.IsRedircet = true;
            TokenValidate.Validate();
            CustID = TokenValidate.CustID;
            //取出问题列表
            DataSet ds = PassWordBO.QueryPwdQuestion();

            //给问题一下拉框赋值
            ddlQuestion1.DataSource     = ds;
            ddlQuestion1.DataValueField = "QuestionID";
            ddlQuestion1.DataTextField  = "Question";
            ddlQuestion1.DataBind();

            //给问题二下拉框赋值
            ddlQuestion2.DataSource     = ds;
            ddlQuestion2.DataValueField = "QuestionID";
            ddlQuestion2.DataTextField  = "Question";
            ddlQuestion2.DataBind();

            //给问题三下拉框赋值
            ddlQuestion3.DataSource     = ds;
            ddlQuestion3.DataValueField = "QuestionID";
            ddlQuestion3.DataTextField  = "Question";
            ddlQuestion3.DataBind();

            //根据当前客户ID取得答案列表
            DataSet dsAnswer = PassWordBO.QueryPwdQuestionAnswer(CustID);

            int j = 0;

            foreach (DataRow row in dsAnswer.Tables[0].Rows)
            {
                if (j == 0)
                {
                    txtHidSq1.Text             = row[0].ToString();
                    ddlQuestion1.SelectedIndex = int.Parse(row[1].ToString());
                    txtAnswer1.Text            = row[2].ToString();
                }
                else if (j == 1)
                {
                    txtHidSq2.Text             = row[0].ToString();
                    ddlQuestion2.SelectedIndex = int.Parse(row[1].ToString());
                    txtAnswer2.Text            = row[2].ToString();
                }
                else if (j == 2)
                {
                    txtHidSq3.Text             = row[0].ToString();
                    ddlQuestion3.SelectedIndex = int.Parse(row[1].ToString());
                    txtAnswer3.Text            = row[2].ToString();
                }

                j++;
            }
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.hdReturnUrl.Value = Request["ReturnUrl"] == null ? ConstHelper.DefaultInstance.BesttoneLoginPage : HttpUtility.UrlDecode(Request["ReturnUrl"]);
            //取出问题列表
            DataSet ds = PassWordBO.QueryPwdQuestion();

            //给问题一下拉框赋值
            ddlQuestion.DataSource     = ds;
            ddlQuestion.DataValueField = "QuestionID";
            ddlQuestion.DataTextField  = "Question";
            ddlQuestion.SelectedIndex  = 1;
            ddlQuestion.DataBind();

            txtQuestion.Value = ddlQuestion.Value;
        }
    }