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

How to tell RadAjaxManager which control got fired

1 Answer 64 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Darryl
Top achievements
Rank 1
Darryl asked on 29 Feb 2012, 05:23 PM
Hi gurus,

I have a Master/Content project with an empty RadScriptManager and RadAjaxManager in the Master page.  I'm using the RadAjaxManagerProxy in the content.

On my content page I have 2 almost identical sets of controls (a search text box and a place to display the results).  You type something into one of the RadTextBoxes and when you hit Enter it runs off to our search engine, fetches some results and plops them nicely under the appropriate RadTextBox in a Label cotrol.  As I mentioned, I have 2 sets of these.  They both work but at the same time, i.e. they both get fired together.  So when I do a search for a Person, the Category event gets fired too.

I am setting the RadAjaxManager up programatically on the Content page (see below).

protected void Page_Load(object sender, EventArgs e)
        {
              
            // Ajax set up
            var manager = RadAjaxManager.GetCurrent(this);
              
            // Add Person
            manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_SearchPerson);
            manager.AjaxSettings.AddAjaxSetting(manager, lblResultsPerson, RadAjaxLoadingPanel1);
  
            // Add Category
            manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_SearchCategory);
            manager.AjaxSettings.AddAjaxSetting(manager, lblResultsCategory, RadAjaxLoadingPanel1);
  
        }

Here is the ASPX:

<tk:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"></tk:RadAjaxManagerProxy>
<tk:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Windows7" InitialDelayTime="200" />
  
<tk:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
  
        function SearchPerson(sender, eventArgs) {
            var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
            ajaxManager.ajaxRequest(sender.get_value());
        }
  
        function SearchCategory(sender, eventArgs) {
            var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
            ajaxManager.ajaxRequest(sender.get_value());
        }
    </script>
</tk:RadCodeBlock>
  
Current time: <asp:Label ID="lblTime" runat="server"></asp:Label>
<br /><br />
<h2>Person search</h2>
  
<tk:RadTextBox ID="txtSearchPerson" runat="server" width="250px" EmptyMessage="Search for a person..." ClientEvents-OnValueChanging="SearchPerson"></tk:RadTextBox>
      
<div class="searchResults">
    <asp:Label ID="lblResultsPerson" runat="server"></asp:Label>
    <asp:Label ID="lblTotalPerson" runat="server" CssClass="searchTotal"></asp:Label>
</div>
  
  
<br /><br />
<h2>Category search</h2>
  
<tk:RadTextBox ID="txtSearchCategory" runat="server" width="250px" EmptyMessage="Search for a category..." ClientEvents-OnValueChanging="SearchCategory"></tk:RadTextBox>
     
<div class="searchResults">
    <asp:Label ID="lblResultsCategory" runat="server"></asp:Label>
    <asp:Label ID="lblTotalCategory" runat="server" CssClass="searchTotal"></asp:Label>
</div>

I know it's probably doing what I'm telling it to do - i.e. run them both!  But that's not what I want - I only want e.g the Category search to fire when I fire off the SearchCategory function - and for that to leave the SearchPerson alone.  What am I missing here?

Many thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 01 Mar 2012, 05:41 PM
Hi Darryl,

I have answered to the support ticket you have opened for this question. Review the provided suggestions and let me know if it works for you.

I would suggest you to continue our communication in the support ticket for better tracking the issue.

Regards,
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.
Tags
Ajax
Asked by
Darryl
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or