Jun 20, 2013, 1:43 PM
[CLOSED] The best way for handle changing class if control when checkbox are checked or unchecked
Hi,
I've dynamically creating pair of Ext.net control and ext.net.checkbox.
id of control is like a PropertyName and checkbox id is always PropertyName_checkbox (PropertyName here is dynamically so it's change in every pair).
Now I would like to change class in control(let it be a table tag of control or input) when checkbox is checked class='editable' and when unchecked class='uneditable'. Should I use for this Listeners or DirectEvent of checkbox?
I've tryed with DirectEvent here is what I've create but it doesn't check anything on DOM:
code of directevent check of checkbox
Thanks,
ViDom
I've dynamically creating pair of Ext.net control and ext.net.checkbox.
id of control is like a PropertyName and checkbox id is always PropertyName_checkbox (PropertyName here is dynamically so it's change in every pair).
Now I would like to change class in control(let it be a table tag of control or input) when checkbox is checked class='editable' and when unchecked class='uneditable'. Should I use for this Listeners or DirectEvent of checkbox?
I've tryed with DirectEvent here is what I've create but it doesn't check anything on DOM:
code of directevent check of checkbox
protected void Check_Event(object sender, DirectEventArgs e)
{
Ext.Net.Checkbox checkBoxExt = (Ext.Net.Checkbox)sender;
string name = ((Ext.Net.Checkbox)sender).ID;
Control ctrl = checkBoxExt.Parent.FindControl(name.Replace("_checkbox", ""));
switch (ctrl.GetType().Name.ToLower())
{
case "textfield":
((Ext.Net.TextField)ctrl).ReadOnly = !checkBoxExt.Checked;
((Ext.Net.TextField)ctrl).FieldStyle = ((Ext.Net.TextField)ctrl).FieldStyle.Replace(!checkBoxExt.Checked ? "editable" : "uneditable", "");
((Ext.Net.TextField)ctrl).FieldStyle = checkBoxExt.Checked ? "editable" : "uneditable";
break;
case "checkbox":
((Ext.Net.Checkbox)ctrl).Disabled = checkBoxExt.Checked;
break;
case "textarea":
((Ext.Net.TextArea)ctrl).ReadOnly = !checkBoxExt.Checked;
((Ext.Net.TextArea)ctrl).FieldStyle = ((Ext.Net.TextArea)ctrl).FieldStyle.Replace(!checkBoxExt.Checked ? "editable" : "uneditable","");
((Ext.Net.TextArea)ctrl).FieldStyle = checkBoxExt.Checked ? "editable" : "uneditable";
break;
}
}
So what your suggestion with that problem. Which style property should I use to make it happend or maybe should I try something better for this like Listner?Thanks,
ViDom
Last edited by Daniil; Jun 25, 2013 at 11:52 AM.
Reason: [CLOSED]