Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void DisableControl(WebControl control)
- {
- if (control is CheckBox)
- {
- ((CheckBox)control).InputAttributes.Add("disabled", "disabled");
- }
- else if (control is RadioButton)
- {
- }
- else if (control is ImageButton)
- {
- ((ImageButton)control).Enabled = false;
- }
- else
- {
- control.Attributes.Add("readonly", "readonly");
- }
- }
- private static void DisableControl(WebControl control)
- {
- Type controlType = control.GetType();
- if (controlType == typeof(CheckBox))
- {
- ((CheckBox)control).InputAttributes.Add("disabled", "disabled");
- }
- else if (controlType == typeof(RadioButton))
- {
- ((RadioButton)control).InputAttributes.Add("disabled", "true");
- }
- else if (controlType == typeof(ImageButton))
- {
- ((ImageButton)control).Enabled = false;
- }
- else
- {
- control.Attributes.Add("readonly", "readonly");
- }
- }
Add Comment
Please, Sign In to add comment