Hello
How to prevent user to write in comboBox? I just need to allow the user to select from the list.
If I set DropDownStyle property to DropDownList, this will work, but I want to keep DropDownStyle = DropDown.
Also, How to prevent a user to write in a textbox without disable it. I have a textbox which will display an output. I need to keep it enabled but not allowing the user to write in.
I tried to set locked property to true as well, but this didn't work. Any idea?
Loading
Hemant SrivastavaPosted Nov 5, 2013, 11:35 AM
private void txtBx_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
private void comboBox2_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
Ablafizi KibikiPosted Nov 5, 2013, 1:17 PM
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("readonly", "readonly");
}
Rano AHPosted Nov 5, 2013, 12:25 PM