This is a migrated thread and some comments may be shown as answers.

CheckBox in FormTemplate and OnCheckedChanged event

2 Answers 242 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vlastimil Poděbradský
Top achievements
Rank 1
Vlastimil Poděbradský asked on 24 Aug 2008, 03:09 PM
Hi,
I have RadGrid with some columns.
I use in RadGrid for edit mode FormTemplate and inside FormTemplate I have some textboxes (some textboxes are disabled and other enabled ) and one checkbox.
 And now in edit mode , when I check off my checkbox, I need to make enable all textboxes.  So I have a problem, because I donĀ“t know, how to catch OnCheckChanged event in  Form Template in RadGrid.
Can anyone help me?
Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 25 Aug 2008, 04:10 AM
Hello Vlastimil,

You can try out the following code, to enable Textboxes in the FormTemplate on the CheckChanged event of a CheckBox.
aspx:
<EditFormSettings EditFormType="Template"
        <FormTemplate> 
            <asp:TextBox ID="TextBox2" Enabled="false" runat="server"></asp:TextBox> 
            <asp:TextBox ID="TextBox3" Enabled="false" runat="server"></asp:TextBox> 
            <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" /> 
        </FormTemplate>            
</EditFormSettings> 

cs:
 protected void CheckBox1_CheckedChanged(object sender, EventArgs e) 
    { 
        CheckBox chkbx = (CheckBox)sender; 
        TextBox txtbx1 = (TextBox)chkbx.NamingContainer.FindControl("TextBox2"); 
        TextBox txtbx2 = (TextBox)chkbx.NamingContainer.FindControl("TextBox3"); 
        txtbx1.Enabled = true
        txtbx2.Enabled = true
    } 

Thanks
Princy.
0
Vlastimil Poděbradský
Top achievements
Rank 1
answered on 25 Aug 2008, 09:29 AM
Thank you so much for answer,
now it's runing right...
Tags
Grid
Asked by
Vlastimil Poděbradský
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Vlastimil Poděbradský
Top achievements
Rank 1
Share this question
or