How to tell RadAjaxManager which control got fired

2 posts, 0 answers
  1. Darryl
    Darryl avatar
    6 posts
    Member since:
    Jun 2011

    Posted 29 Feb 2012 Link to this post

    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 %>");
            function SearchCategory(sender, eventArgs) {
                var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
    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>
    <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>

    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!
  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 01 Mar 2012 Link to this post

    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.

    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