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

show textbox when user marks checkbox in radgrid

1 Answer 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hadoop
Top achievements
Rank 1
Hadoop asked on 23 Nov 2015, 11:24 PM

I've a radgrid where there are checkboxex. The data comes from database. On of the value is "OTHERS". I want that when user checks the "OTHERS" checkbox, textbox should appear by its side. How can it be done using JAVASCRIPT or by using any radgrid property like OnPreRender ?

 

<telerik:RadGrid ID="grid_diag_group" runat="server"                       
                        Width="100%"                     
                        AutoGenerateColumns="false"
                        HeaderStyle-HorizontalAlign="Left" >
                        <MasterTableView>
                            <Columns>
                                <telerik:GridTemplateColumn UniqueName="TempCol1" HeaderText="Select" ReadOnly="true">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" />
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:CheckBox ID="CheckBox2" runat="server" />
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="diag_code" Display="false" Visible="true" AutoPostBackOnFilter="false" ItemStyle-HorizontalAlign="Left" CurrentFilterFunction="Contains" />                              
                                <telerik:GridBoundColumn DataField="diag_desc" UniqueName="diag_description" HeaderText="Diagnosis"
                                    AutoPostBackOnFilter="false" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                        </MasterTableView>
</telerik:RadGrid>

 My UI looks like this >> ( checkbox == [])

[]  MALARIA
[]  T.B.
[]  GLYCOMA
[]  MEASELES
[]  FUNGAL INFECTION
[]  OTHERS
When user checks the OTHERS checkbox, textbox should appear beside "OTHERS" inside the grid. How can I do it?  

Please help !!! Thanks.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 26 Nov 2015, 02:38 PM
Hello Hadoop,

You can achieve this requirement by replacing the diag_code column with a Template column:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/columns/column-types#gridtemplatecolumn

Then, within the ItemTemplate next to the Label you will create a RadTextBox with its Visible property set to False. When the CheckBox1 is checked, you can then access the corresponding row, verify whether the text is OTHERS and if it is, you can set the Visible property of the textbox to true.

I hope this will prove helpful.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Hadoop
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or