我做了一个手机好网站
我用FormView1插入,r1TextBox、r2TextBox、r3TextBox是第1、2、3位数:
我现在想让在插入数据的时候自动插入号段HDTextBox,尾号类型WHGLTextBox,和运营商,可是我要怎么能实现呢?
我是想用这个控件来插入,不想写后台连接数据库代码。
我在插入数据的时候所有的控件都没有问题,但是号段、尾号类型、运营商插入为空,请问我下边的代码哪里出错了
protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
        TextBox txtbox1 = (TextBox)FormView1.FindControl("r1TextBox");
        TextBox txtbox2 = (TextBox)FormView1.FindControl("r2TextBox");
        TextBox txtbox3 = (TextBox)FormView1.FindControl("r3TextBox");
        TextBox txtbox8 = (TextBox)FormView1.FindControl("r8TextBox");
        TextBox txtbox9 = (TextBox)FormView1.FindControl("r9TextBox");
        TextBox txtbox10 = (TextBox)FormView1.FindControl("r10TextBox");
        TextBox txtbox11 = (TextBox)FormView1.FindControl("r11TextBox");
        TextBox txtboxYYS = (TextBox)FormView1.FindControl("YYSTextBox");
        TextBox txtboxHD = (TextBox)FormView1.FindControl("HDTextBox");
        TextBox txtboxWHGL = (TextBox)FormView1.FindControl("WHGLTextBox");
        int txt = FormView1.Controls.Count;
        string hd = txtbox1.Text + txtbox2.Text + txtbox3.Text;        txtboxHD.Text = txtbox1.Text + txtbox2.Text + txtbox3.Text;        if (txtbox8.Text == txtbox10.Text && txtbox9.Text == txtbox1.Text) txtboxWHGL.Text = "ABAB";
        else if (txtbox8.Text == txtbox9.Text && txtbox10.Text == txtbox11.Text) txtboxWHGL.Text = "AABB";
        else if ((txtbox8.Text == (int.Parse(txtbox9.Text) + 1).ToString() && txtbox9.Text == (int.Parse(txtbox10.Text) + 1).ToString() && txtbox10.Text == (int.Parse(txtbox11.Text) + 1).ToString()) || (txtbox8.Text == (int.Parse(txtbox9.Text) - 1).ToString() && txtbox8.Text == (int.Parse(txtbox9.Text) - 1).ToString() && txtbox8.Text == (int.Parse(txtbox9.Text) - 1).ToString())) txtboxWHGL.Text = "ABCD";
        else if (txtbox8.Text == txtbox9.Text && txtbox9.Text == txtbox10.Text && txtbox10.Text == txtbox11.Text) txtboxWHGL.Text = "AAAA";
        else if (txtbox8.Text == txtbox9.Text && txtbox9.Text == txtbox10.Text && txtbox10.Text != txtbox11.Text) txtboxWHGL.Text = "AAAB";
        else if (txtbox8.Text != txtbox9.Text && txtbox9.Text == txtbox10.Text && txtbox10.Text == txtbox11.Text) txtboxWHGL.Text = "BAAA";
        else if (txtbox8.Text != txtbox9.Text && txtbox9.Text != txtbox10.Text && txtbox10.Text == txtbox11.Text) txtboxWHGL.Text = "AA";
        else txtboxWHGL.Text = "其他";        switch (hd)
        {
            case "134":
                txtboxYYS.Text = "中国移动";
                break;
            case "135":
                txtboxYYS.Text = "中国移动";
                break;
            case "136":
                txtboxYYS.Text = "中国移动";
                break;
            case "137":
                txtboxYYS.Text = "中国移动";
                break;
            case "138":
                txtboxYYS.Text = "中国移动";
                break;
            case "139":
                txtboxYYS.Text = "中国移动";
                break;
            case "147":
                txtboxYYS.Text = "中国移动";
                break;
            case "150":
                txtboxYYS.Text = "中国移动";
                break;
            case "151":
                txtboxYYS.Text = "中国移动";
                break;
            case "152":
                txtboxYYS.Text = "中国移动";
                break;
            case "158":
                txtboxYYS.Text = "中国移动";
                break;
            case "159":
                txtboxYYS.Text = "中国移动";
                break;
            case "182":
                txtboxYYS.Text = "中国移动";
                break;
            case "187":
                txtboxYYS.Text = "中国移动";
                break;
            case "188":
                txtboxYYS.Text = "中国移动";
                break;
            case "130":
                txtboxYYS.Text = "中国联通";
                break;
            case "131":
                txtboxYYS.Text = "中国联通";
                break;
            case "132":
                txtboxYYS.Text = "中国联通";
                break;
            case "155":
                txtboxYYS.Text = "中国联通";
                break;
            case "156":
                txtboxYYS.Text = "中国联通";
                break;
            case "185":
                txtboxYYS.Text = "中国联通";
                break;
            case "186":
                txtboxYYS.Text = "中国联通";
                break;
            case "133":
                txtboxYYS.Text = "中国电信";
                break;
            case "153":
                txtboxYYS.Text = "中国电信";
                break;
            case "189":
                txtboxYYS.Text = "中国电信";
                break;
        }