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

RadPanelBar ExpandMode not working

2 Answers 122 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
IDOX Health
Top achievements
Rank 1
IDOX Health asked on 12 Aug 2010, 10:11 AM
Hi,

I am using a RadPanelBar and within the RadPanelBar I have a radgrid, that is being populated by data OnItemClick event.

My problem is that all expansion behavior is lost once a panel bar is open it cannot be closed again, and ieve the SingleExpanededItem expandMode is lost.

Any Help?

Thanks.

HTML SNIPPET
<telerik:RadPanelBar ID="rpbStudentList" runat="server" Width="100%" OnItemClick="rpbStudentList_ItemClick"
                                ExpandMode="SingleExpandedItem">
                                <ItemTemplate>
                                    <telerik:RadGrid ID="rgrdScheduleList" runat="server" AutoGenerateColumns="False"
                                        GridLines="None" Visible="False" OnItemDataBound="rgrdScheduleList_ItemDataBound">
                                        <MasterTableView>
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="SAT_PK" HeaderText="SATPK" UniqueName="SAT_PK"
                                                    Visible="False">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="SAT_CSTU_FK" HeaderText="SATCSTUFK" UniqueName="SAT_CSTU_FK"
                                                    Visible="False">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="SAT_SBO_FK" HeaderText="SATSBOFK" UniqueName="SAT_SBO_FK"
                                                    Visible="False">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="CSC_PK" HeaderText="CSCPK" UniqueName="CSC_PK"
                                                    Visible="False">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="CSC_DATE" HeaderText="Lesson Date" UniqueName="CSC_DATE"
                                                    Visible="True" DataFormatString="{0:dd/MMM/yyyy}">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="CSC_TIME_FROM" HeaderText="Time From" UniqueName="CSC_TIME_FROM"
                                                    Visible="True" DataFormatString="{0:hh:mm}">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="CSC_TIME_TO" HeaderText="Time To" UniqueName="CSC_TIME_TO"
                                                    Visible="True" DataFormatString="{0:hh:mm}">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridTemplateColumn UniqueName="SAT_ABSENT" HeaderText="Attendance" Visible="true">
                                                    <ItemTemplate>
                                                        <table>
                                                            <tr>
                                                                <td>
                                                                    <asp:RadioButton ID="rbtnPresent" runat="server" GroupName="AttendanceTemplate" Text="Present"
                                                                        Checked="true" />
                                                                </td>
                                                                <td>
                                                                    <asp:RadioButton ID="rbtnAbsent" runat="server" GroupName="AttendanceTemplate" Text="Absent" />
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridTemplateColumn UniqueName="SAT_REASON" HeaderText="Absence Reason" Visible="true"
                                                    DataField="ABSENCE_REASON_LIST">
                                                    <ItemTemplate>
                                                        <telerik:RadComboBox ID="rddlReason" runat="server" DataValueField="SAR_PK" DataTextField="SAR_REASON">
                                                        </telerik:RadComboBox>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridTemplateColumn UniqueName="SAT_COMMENTS" HeaderText="Comments" Visible="true"
                                                    DataField="SAT_COMMENTS">
                                                    <ItemTemplate>
                                                        <telerik:RadTextBox ID="rtxtComments" runat="server" Text='<%# Eval("SAT_COMMENTS") %>'>
                                                        </telerik:RadTextBox>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                            </Columns>
                                        </MasterTableView>
                                    </telerik:RadGrid>
                                    <asp:Button ID="btnSave" runat="server" Text="Button" Visible="false" OnClick="btnSave_Click" />
                                </ItemTemplate>
                            </telerik:RadPanelBar>

C# RadPanelBar Bind

rpbStudentList.DataSource = list;
rpbStudentList.DataTextField = "STD_STUDENT_FULLNAME";
rpbStudentList.DataValueField= "STD_PK";
rpbStudentList.DataBind();


C# RadPanelBar OnItemClick

RadGrid rgrdScheduleList = (e.Item.FindControl("rgrdScheduleList") as RadGrid);
rgrdScheduleList.Visible = true;
rgrdScheduleList.DataSource = sessionStudentAttendance.STUDENT_ATTENDANCE_LIST;
rgrdScheduleList.DataBind();

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 Aug 2010, 01:15 PM
Hello Ivan,

I've already replied to the support forum regarding this issue. I'm pasting my reply here:

The reason for this is that the item template is set globally and this means that it is applied to all the items - including the root items - when root items have templates they cannot be expanded and collapsed. You should set the template to the subitems only, this can be done in the aspx if your items are also defined there or dynamically as demonstrated here.


Regards,
Yana
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
0
IDOX Health
Top achievements
Rank 1
answered on 03 Sep 2010, 12:05 PM
I tried it out and worked fine but its not what I really wanted as an output, so i used the Rad Grid and the hierarchy.

Thanks.

Tags
PanelBar
Asked by
IDOX Health
Top achievements
Rank 1
Answers by
Yana
Telerik team
IDOX Health
Top achievements
Rank 1
Share this question
or