Hi,
I´m making a custom Sitefinity control and I have some problems getting the RadListView and RadDataPager to function with the AjaxManagerProxy. I think I need to set the AjaxManager in code behind due to sitefinity, but I can´t get it to work properly. The control loads with 3 paging buttons and if I click on number 2, button number 3 disapears. Also, I don´t think all the rows in the NeedDataSource gets loaded, or at least the paging don´t seem to know about it. Any ideas?
I´m making a custom Sitefinity control and I have some problems getting the RadListView and RadDataPager to function with the AjaxManagerProxy. I think I need to set the AjaxManager in code behind due to sitefinity, but I can´t get it to work properly. The control loads with 3 paging buttons and if I click on number 2, button number 3 disapears. Also, I don´t think all the rows in the NeedDataSource gets loaded, or at least the paging don´t seem to know about it. Any ideas?
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> </telerik:RadAjaxManagerProxy> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"> </telerik:RadAjaxLoadingPanel> <div class="localEventContainer"> <asp:Panel ID="ListViewPanel" runat="server"> <div class="localEventTop"><asp:Label ID="lblControlTitle" runat="server"></asp:Label></div> <telerik:RadListView ID="RadListView1" runat="server" AllowPaging="True" DataKeyNames="EventID" ItemPlaceholderID="EventItemContainer" Skin="Black" OnDataBound="RadListView1_DataBound" OnNeedDataSource="RadListView1_NeedDataSource"> <LayoutTemplate> <asp:Panel ID="EventItemContainer" runat="server"></asp:Panel> <table cellpadding="0" cellspacing="0" width="100%;" style="clear: both;"> <tr> <td> <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1" PageSize="5"> <Fields> <telerik:RadDataPagerButtonField FieldType="FirstPrev" /> <telerik:RadDataPagerButtonField FieldType="Numeric" /> <telerik:RadDataPagerButtonField FieldType="NextLast" /> </Fields> </telerik:RadDataPager> </td> </tr> </table> </LayoutTemplate> <ItemTemplate> <div class="localEventArticleContainer"> <div class="localEventTitle"> <asp:Label ID="lblEventName" runat="server" Text='<%# Eval("Name") %>'></asp:Label> </div> <div class="localEventDate"> <asp:Label ID="lblDate" runat="server" Text='<%# Eval("Date", "{0:d}") %>'></asp:Label> <asp:Label ID="lblTime" runat="server" Text='<%# Eval("Starttime") %>'></asp:Label> </div> <div class="localEventText"> <asp:Label ID="lblText" runat="server" Text='<%# Eval("LocationName") %>'></asp:Label> </div> <%--<div class="localEventLink"> <asp:HyperLink ID="lblLink" runat="server" Text="Ticnet.se" NavigateUrl='<%# Eval("Url") %>' Target="_blank"></asp:HyperLink> </div>--%> </div> </ItemTemplate> </telerik:RadListView> </asp:Panel> <div class="localEventBottom"></div> </div>protected override void OnInit(EventArgs e) { base.OnInit(e); if (this.Page != null && !this.DesignMode) { RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page); if (ajaxManager != null) { ajaxManager.AjaxSettings.AddAjaxSetting(ListViewPanel, ListViewPanel, RadAjaxLoadingPanel1); } lblEventAreaID.Text = EventAreaID.ToString(); } }protected void RadListView1_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e) { RadListView1.DataSource = ReadData("SELECT e.EventID, e.Name,e.Url, ev.Name AS LocationName, et.Date, et.Starttime FROM mp_Event e INNER JOIN mp_EventLocation ev ON e.EventLocationID = ev.EventLocationID INNER JOIN mp_EventTime et on e.EventID = et.EventID WHERE " + "ev.AreaID = @AreaID AND " + "et.Date >= '" + Today + "' ORDER BY Date ASC"); } private SqlDataReader ReadData(string query) { string connString = ConfigurationManager.ConnectionStrings["UnigolfMPTestConnectionString"].ConnectionString; conn = new SqlConnection(connString); conn.Open(); SqlCommand cmd = new SqlCommand(query, conn); cmd.Parameters.AddWithValue("@AreaID", lblEventAreaID.Text); reader = cmd.ExecuteReader(); return reader; } protected void RadListView1_DataBound(object sender, EventArgs e) { reader.Close(); conn.Close(); }