想在后台编写代码,让textbox中的内容在修改过程中不能修改,但在添加用户数据时可以修改并保存,新生菜鸟,帮帮忙哈O(∩_∩)O哈!

解决方案 »

  1.   

    后台代码操作textbook的readonly属性。。
      

  2.   

    TextBox1.Enabled=false;
    或 设置Textbox的ReadOnly属性为true
      

  3.   

    TextBox1.Enabled=false;
    ~~
       只有这2种办法了~~
    结账吧~~
      

  4.   

    private void txtContainerNo_KeyPress(object sender, KeyPressEventArgs e)
            {
                    e.Handled = true;   //取消按键动作
            }
      

  5.   

    public void doOperate(...., string flag ){
    ..........
    if( flag=="udate" )
    {
     textBox2.ReadOnly = true;
    }
    .......
    }
    O(∩_∩)OO(∩_∩)O哈哈~
      

  6.   


    -_-
            private void txtContainerNo_KeyPress(object sender, KeyPressEventArgs e)
            {
                if(flag)
                    e.KeyCode='\0';
            }
      

  7.   

    改ReadOnly、Enabled,没有特定需求改Visibled都行。或者高个标志变量写
    KeyDown、KeyUp、KeyPress、TextChanged……
    要实现这个效果方法多了去了。
      

  8.   


    后台代码操作textbook的readonly属性。。这个属性的赋值是让用户只能看  不能更改的
      

  9.   

    你是添加修改一个界面吧?添加的时候 到这个界面是没有ID的 你就正常if(request["id"]!=null)
     textBox.Attributes.add("readonly","true");
      

  10.   


    都不能修改了,怎么用户还能添加数据,有点蒙了呀!你的意思是不是添加数据然后在显示到textbox中,如果是这样设置textbox的readonly属性为true就可以了呀!!
      

  11.   

    TextBox.ReadOnly = true
    或者
    TextBox.Enabled = false
    或者
    TextBox 的 KeyPressed 事件加入
    e.Handled = true;
      

  12.   

    处理时,用一个标志位标示是不是修改,如果是修改,就设ReadOnly=true;多简单哪,O(∩_∩)O哈哈~