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

update radgrid with radiobuttons

1 Answer 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Gunderson
Top achievements
Rank 1
David Gunderson asked on 01 Apr 2011, 03:39 PM
What I have is a grid that I am loading questions with a asp radiobutton with a go or a no\go.  I have a set of questions and then some question might have sub questions that i load into the grid.  a nested radgrid with the main question and sub questions.  What I need to happen if a sub question radio button is picked as a no\go I need the main question button to automatically be changed to a no\go as well.  Is this possible with a nested grid.  Here is an example of my radgrid.  I also need to save all of them to a table with the question answer on a asp submit button, how do you itterate through the main and then sub tables to save the information.


<table width="100%">
                <tr>
                    <td align="center"><telerik:RadGrid ID="RadGrid2" runat="server" CellSpacing="0" GridLines="both" Skin="WebBlue" Width="90%" GroupingSettings-ShowUnGroupButton="false"  >
                        <MasterTableView AutoGenerateColumns="false" DataKeyNames="intQuestionID">
                            <Columns>
                                <telerik:GridBoundColumn DataField="strQuestion" HeaderText="Question" UniqueName="strQuestion" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <telerik:GridTemplateColumn HeaderText="GO\NOGO" HeaderStyle-HorizontalAlign="Center" ShowSortIcon="True" Visible="True">
                                    <ItemTemplate>
                                        <asp:RadioButtonList ID="rblAnswer" runat="server" RepeatDirection="Horizontal" TextAlign="Right" CellPadding="5" >
                                            <asp:ListItem Value="0">GO</asp:ListItem>
                                            <asp:ListItem Value="1">NO\GO</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Data" HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <telerik:RadTextBox runat="server" Width="100"></telerik:RadTextBox>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                 <telerik:GridTemplateColumn HeaderText="Remarks" HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <telerik:RadTextBox ID="txtRemarks" runat="server" Width="100"></telerik:RadTextBox>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Date" HeaderStyle-HorizontalAlign="Center">
                                      <ItemTemplate>
                                        <telerik:RadDatePicker ID="radDate" runat="server"></telerik:RadDatePicker>
                                      </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                            <DetailTables>
                                <telerik:GridTableView Name="RadGrid2Sub" runat="server" DataKeyNames="intsubQID" TableLayout="Fixed" AutoGenerateColumns="false">
                                    <ParentTableRelation>
                                        <telerik:GridRelationFields DetailKeyField="intQuestionID" MasterKeyField="intQuestionID" />
                                    </ParentTableRelation>
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="strSubQ" HeaderText="Sub-Question" UniqueName="strSubQ" HeaderStyle-HorizontalAlign="Center" />
                                         <telerik:GridTemplateColumn HeaderText="GO\NOGO" HeaderStyle-HorizontalAlign="Center" ShowSortIcon="True" Visible="True">
                                            <ItemTemplate>
                                                <asp:RadioButtonList ID="rblAnswer2" runat="server" RepeatDirection="Horizontal" TextAlign="Right" CellPadding="5" >
                                                    <asp:ListItem Value="0">GO</asp:ListItem>
                                                    <asp:ListItem Value="1">NO\GO</asp:ListItem>
                                                </asp:RadioButtonList>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                    </telerik:GridTableView>
                            </DetailTables>
                        </MasterTableView>
                    </telerik:RadGrid></td>
                </tr>
            </table>

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 07 Apr 2011, 08:10 AM
Hello David,

Please refer to the following help article explaining how to iterate items in hierarchy. You can also access the parent row from the child item like that: item.OwnerTableView.ParentItem. Then you access the radiobutton in the cell as described here.

Best wishes,
Marin
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
David Gunderson
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or