I'm using the RadListView in my project which is setup like so:
| <telerik:RadListView ID="lvCalendars" runat="server" AllowPaging="True" DataKeyNames="Listing_ID" |
| DataSourceID="dsListing" OnItemDataBound="lvCalendars_ItemDataBound"> |
| <LayoutTemplate> |
| <telerik:RadDataPager ID="dpTopPager" runat="server" PagedControlID="lvCalendars" |
| PageSize="7" Skin="Office2007"> |
| <Fields> |
| <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="10" /> |
| </Fields> |
| </telerik:RadDataPager> |
| <table cellpadding="0" cellspacing="0" width="100%" class="bgStandardMedium"> |
| <tr id="itemPlaceholder" runat="server"> |
| </tr> |
| </table> |
| <telerik:RadDataPager ID="dpBottomPager" runat="server" PagedControlID="lvCalendars" |
| PageSize="7" Skin="Office2007"> |
| <Fields> |
| <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="10" /> |
| </Fields> |
| </telerik:RadDataPager> |
| </LayoutTemplate> |
| <ItemTemplate> |
| <tr> |
| <td class="bgStandardDark propertySection"> |
| <asp:Image ID="imgProperty" runat="server" Width="130px" Height="90px" AlternateText='<%#Eval("Name") %>' |
| ToolTip='<%#Eval("Name") %>' /> |
| <span class="propertyName"> |
| <%#DataBinder.Eval(Container, "DataItem.Name").ToString() %> |
| </span> |
| <asp:HyperLink ID="lnkBookProperty" runat="server" CssClass="buttonStandard" Text="<span>Book Property</span>" |
| Width="170px"></asp:HyperLink> |
| <br /> |
| <br /> |
| <asp:LinkButton ID="lnkPrintCalendar" runat="server" CssClass="buttonStandard" Width="170px" |
| Text="<span>Print Reservation List</span>"></asp:LinkButton> |
| </td> |
| <td class="calendarSection"> |
| <telerik:RadAjaxPanel ID="apBookingCalendar" runat="server" LoadingPanelID="LoadingPanel1"> |
| <telerik:RadCalendar ID="calBooking" runat="server" MultiViewColumns="4" MultiViewRows="1" |
| EnableMultiSelect="false" ShowRowHeaders="False" ShowOtherMonthsDays="False" |
| AutoPostBack="True" CssClass="bookingCalendar" OnDefaultViewChanged="calBooking_DefaultViewChanged"> |
| <CalendarTableStyle Width="175px" Height="196px" /> |
| </telerik:RadCalendar> |
| <div class="button-row" style="text-align: center;"> |
| <asp:LinkButton ID="lnkbtnViewFullYear" runat="server" CssClass="buttonStandard" |
| Text="<span>View Full Year</span>" Width="150px" /> |
| </div> |
| </telerik:RadAjaxPanel> |
| </li> |
| </td> |
| </ItemTemplate> |
| </telerik:RadListView> |
Now in my calendar's OnDefaultViewChanged event I attempt to retrieve the RadListViewDataItem it's contained in like so:
| protected void calBooking_DefaultViewChanged(Object sender, Telerik.Web.UI.Calendar.DefaultViewChangedEventArgs e) |
| { |
| try |
| { |
| // get calendar |
| RadCalendar calBooking = (RadCalendar)sender; |
| // get RadListViewDataItem |
| RadListViewDataItem dtItem = (RadListViewDataItem)calBooking.Parent.Parent; |
| // hold Sub Listing |
| SubListing subListing = new SubListing(); |
| // hold Listing |
| Listing listing; |
| // check if data item is a listing |
| if (dtItem.DataItem is Listing) |
| { |
| // get listing |
| listing = (Listing)dtItem.DataItem; |
| } |
| else |
| { |
| // get sub listing |
| subListing = (SubListing)dtItem.DataItem; |
| // get listing |
| listing = subListing.Listing; |
| } |
| //...calendar setup code follows |
| } |
| catch (Exception ex) |
| { |
| } |
| } |
Now apparently DataItem does not exist, I get a null value. I was able to retrieve the DataItem object in the ItemDataBound event of the RadListView control but not in the calendar event.
Is there a reason for this or is it some bug in the RadListView control?
I am using the latest version of the controls 3.1105 (.NET 3.5).
