Update Control on Parent Page

2 posts, 0 answers
  1. Neil N
    Neil N avatar
    89 posts
    Member since:
    Aug 2012

    Posted 01 Mar 2013 Link to this post

    Scenario:
    Master page with no AjaxManager
    Content page containing an AjaxManager and RadMultiPage control working with a RadTabStrip control
    User control with an empty RadAjaxManagerProxy

    User clicks a button in the user control, some server side code executes and then an event call is bubbled up to the content page.  This event updates a label on the content page.  I can see the code executing properly but the label doesn't get updated.  Tried various AjaxManager settings with no luck.

    Condensed Content page aspx:
    <%@ Page Language="VB" MasterPageFile="M_Master.master" AutoEventWireup="false" CodeFile="dashboard.aspx.vb" Inherits="dashboard" title="Data Entry" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <%@ Register Src="tabpages/dashboardMethodology.ascx" TagName="Methodology" TagPrefix="uc1" %>
    <%@ Register Src="tabpages/dashboardSubmit.ascx" TagName="Submit" TagPrefix="uc1" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="MasterContent" Runat="Server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ddlObligationYear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblYear" />
                    <telerik:AjaxUpdatedControl ControlID="ddlPeriods" />
                    <telerik:AjaxUpdatedControl ControlID="lblEntry" />
                    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
             <telerik:AjaxSetting AjaxControlID="ddlPeriods">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblYear" />
                    <telerik:AjaxUpdatedControl ControlID="lblEntry" />
                    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="pvSubmit">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblEntry" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
        <telerik:radformdecorator id="FormDecorator1" runat="server" DecoratedControls="Buttons,Checkboxes,Label"></telerik:radformdecorator>
    <asp:Panel runat="server" ID="pnDashboard" CssClass="panel" Width="580pt">
        <div id="body">                      
        <telerik:RadWindowManager runat="server" ID="radWindowMngr"></telerik:RadWindowManager>
     
        <div class="subheader"><asp:Literal runat="server" ID="lblYear" Text="" /></div><br />
            <div id="reportingHeader">
            <table width="100%">
                <tr>
                    <td width="20%"><asp:Label ID="Label1" runat="server" Text="Reporting Year:"></asp:Label></td>
                    <td width="15%"><asp:DropDownList ID="ddlObligationYear" runat="server" AutoPostBack="True" TabIndex="100"></asp:DropDownList></td>
                    <td width="10%"><asp:Label ID="Label2" runat="server" Text="Period:"></asp:Label></td>
                    <td width="15%"><asp:DropDownList ID="ddlPeriods" runat="server" AutoPostBack="True" TabIndex="100" Width="120px"></asp:DropDownList>  </td>
                    <td width="40%"><asp:Label ID="lblEntry" runat="server" CssClass="rjtext" Font-Bold="True" Width="360px"></asp:Label></td>
                </tr>
                </table>
                <br />          
            </div><br />  
           <asp:Panel runat="server" ID="pnTabs" Width="100%">
                <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0">
                    <Tabs>
                        <telerik:RadTab runat="server" Text="Report Methodology" Value="Methodology" PageViewID="pvMethodology" />
                        <telerik:RadTab runat="server" Text="Submit Report" Value="Submit" PageViewID="pvSubmit" />
                    </Tabs>        
                </telerik:RadTabStrip>
                <br />
                <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" RenderSelectedPageOnly="true">       
                    <telerik:RadPageView ID="pvMethodology" runat="server">
                        <uc1:Methodology runat="server" ID="tpMethodology" />
                    </telerik:RadPageView>
                    <telerik:RadPageView ID="pvSubmit" runat="server">
                        <uc1:Submit runat="server" ID="tpSubmit" />
                    </telerik:RadPageView>
                </telerik:RadMultiPage>
            </asp:Panel>                        
        </div>   
         </asp:Panel>    
    </asp:Content>

    Condensed Content page vb:
    Imports Telerik.Web.UI
    Imports System.Data
    Imports System.Math
    Imports BusinessObjects
     
    Partial Class dashboard
        Inherits PageManager
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            checkSession()
     
            dashboardSubmit1 = tpSubmit
            AddHandler dashboardSubmit1.refreshHeaders, AddressOf Me.refreshHeaders
     
            If Not IsPostBack Then
                populateYearsDropdown()
                populatePeriodDropdownlist(ddlPeriods, CurrentSession.submission_year)
                getFirstSubmissionPeriod()
     
                retrieveReportTab()
                setHeaders()
            Else        
                CType(Me.FindControl("tp" + Right(RadTabStrip1.FindTabByValue(Session("clickedTab")).PageViewID, Len(RadTabStrip1.FindTabByValue(Session("clickedTab")).PageViewID) - 2)), tabpage).reloadTab()
     
                ids_yearinfo = Session("ids_yearinfo")
                lblEntry.Text = Session("PeriodSubmitted")
            End If
     
        End Sub
     
        Protected Sub setHeaders()
            'Set header text
            lblEntry.Text = Session("PeriodSubmitted")
     
            If Session("PeriodSubmitted") = "NOT SUBMITTED" Then
                lblEntry.CssClass = "notsubtext"
            Else
                lblEntry.CssClass = "subtext"
            End If
        End Sub
     
        Sub refreshHeaders(sender As Object, e As System.EventArgs)
            populateYearsDropdown()
            populatePeriodDropdownlist(ddlPeriods, CurrentSession.submission_year)
            setHeaders()
        End Sub
    End Class

    User control vb:
    Imports Telerik.Web.UI
    Imports System.Data
    Imports System.Math
    Imports BusinessObjects
     
    Partial Class dashboardSubmit
        Inherits tabpage
     
        Public Event refreshHeaders As EventHandler
     
     
        Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click
            Dim Report As New Reports
     
       
            Session("PeriodSubmitted") = Report.submitReport(Session("nReportID"), CurrentSession.login_id)
     
            CurrentSession.read_only = True
            retrieveDeclationInfo()
     
            RaiseEvent refreshHeaders(Me, e)
        End Sub
     
    End Class

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 06 Mar 2013 Link to this post

    Hello Neil,

    Please note that Single PageView or control added in PageView could not be added as AJAX initiator or updated control in the AJAX settings. The only possible approach is to add the whole MultiPage in the RadAjaxManager settings. See the topic below:

    http://www.telerik.com/help/aspnet-ajax/ajax-tips-and-tricks.html

    Therefore in your case you should add a settings in which the pnTabs updates itself and also updates the needed label. Give this a try and let me know if this helps.

    All the best,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top