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

Update control in parentpage using radajaxmanager and usercontrol

1 Answer 181 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Prava kafle
Top achievements
Rank 1
Prava kafle asked on 20 Sep 2010, 05:09 PM
Hi,
I have  a RadComboBox named "TicketTypeComboBox",  Panel1 and Panel2.   Panel2 wraps  a userControl named "SearchForm".  This usercontrol has a Button with an ID = "SearchBtn".
Selectedindex changed event in TicketTypeComboBox should toggle visibility of Panel1 and Panel2. Similarly,  click event of SearchBtn sends an ajax request to hide Panel2 and show Panel1. Given below is the ajax setting for project. RadCombox  works as expected and tooggles the visibility of Panel1 and panel2 untill you hit Search Btn in usercontrol.
On Clicking "searchBtn" it hides panel2 and shows panel1, and it messes up  the function of "TicketTypeComboBox".  TicketTypeComboBox sends ajax request but can no longer update any of its updated control. Can someone tell me why this is happening? Am I missing something?

//Markup for ajax setting
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
           onajaxrequest="RadAjaxManager1_AjaxRequest" EnablePageHeadUpdate="False"   >
     <telerik:AjaxSetting AjaxControlID="TicketTypeComboBox">
                    <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="Panel1" />
                        <telerik:AjaxUpdatedControl ControlID="Panel2" />
                    </UpdatedControls>
    </telerik:AjaxSetting>   
  <telerik:AjaxSetting AjaxControlID="SearchBtn">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Panel1" />
                        <telerik:AjaxUpdatedControl ControlID="Panel2" />
                    </UpdatedControls>
  </telerik:AjaxSetting>
</telerik:RadAjaxManager>

//MarkUp for MainPage
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" EnableViewState="true" %>
    ..
    ..
    <telerik:RadComboBox ID="TicketTypeComboBox" runat="server"  AutoPostBack="true"  EnableViewState="true"
                        onselectedindexchanged="TicketTypeComboBox_SelectedIndexChanged" >
                </telerik:RadComboBox>   
    <asp:Panel ID="Panel1" runat="server"  CssClass="HideQueryNTicketPanel" >
                                 <telerik:RadGrid  ID="TicketsGrid"  runat="server"   >   </telerik:RadGrid>
                    </asp:Panel>
                <asp:Panel ID="Panel2" runat="server" CssClass="ShowQueryNTicketPanel" >
                                <uc1:CSearch ID="SearchForm" runat="server" ></uc1:CSearch>
                </asp:Panel>    
    ...
    ...


//Codebehind
  protected void TicketTypeComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            string selectedText = TicketTypeComboBox.SelectedValue;
            switch (selectedText)
         {
            case ("Open Tickets"):
    Panel1.visible = true;
    Panel2.visible = false;
                   break;
            case ("Assigned Tickets"):
                   Panel1.visible = false;
    Panel2.visible = true;
                   break;
    }           
}
//MarkUp for userControl ("SearchForm")
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CustomSearch.ascx.cs" Inherits="CustomSearch" %>
<asp:UpdatePanel ID="QueryPanelUPD" runat="server" UpdateMode="Conditional" >
     <ContentTemplate>
             <asp:Panel  ID="QueryPanel"  runat="server" CssClass="ShowPanel" >
                           <asp:Button  ID="SearchBtn"        runat="server" Text="Add"    onclick="SearchBtn_Click" />
           </asp:Panel>
     </ContentTemplate>
  </asp:UpdatePanel>


//Codebehind for usercontrol

  protected void SearchBtn_Click(object sender, EventArgs e)
    {
        Panel1.visible = true;
        Panel2.visible = false;
    }

Sincerely,
Prava

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 22 Sep 2010, 10:06 AM
Hi Prava,

RadAjaxManager could handle all the MasterPage and WebUserControls scenarios no matter the complexity of the application. You can review the following help topic which elaborates on this matter.
http://www.telerik.com/help/aspnet-ajax/ajxloadcontrolfromanotherwebusercontrolindifferentmasterpagecontentplaceholder.html

Test the provided approach and let us know if this helps.

Best wishes,
Pavlina
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
Ajax
Asked by
Prava kafle
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or