Pass ID from RadMenu to e.Value for use with XmlHttpPanel

3 posts, 1 answers
  1. Trent
    Trent avatar
    19 posts
    Member since:
    Apr 2009

    Posted 07 Dec 2010 Link to this post

    Hello,

    I am having difficulty passing the selected menu item to a RadXmlHttpPanel, would any one be able to help??

       <form id="form1" runat="server">
       <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
           <Scripts>
               <%--Needed for JavaScript IntelliSense in VS2010--%>
               <%--For VS2008 replace RadScriptManager with ScriptManager--%>
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
           </Scripts>
       </telerik:RadScriptManager>
       <script type="text/javascript">
           
                 function onClicking(sender, eventArgs) {
                        var item = eventArgs.get_item();
                        var panel = $find("<%=RadXmlHttpPanel1.ClientID%>");
                        //panel.set_value(item.get_text());
                        panel.set_value(item.ID);
                    }
                 function onClicking(sender, eventArgs) {
                        var item = eventArgs.get_item();
                        var panel = $find("<%=RadXmlHttpPanel1.ClientID%>");
                        //panel.set_value(item.get_text());
                        panel.set_value(item.ID);
                    }
       </script>
       <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadMenu1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
       <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Office2007">
       </telerik:RadSkinManager>
       <div>
    <script type="text/javascript">
            function onClicking(sender, eventArgs) {
                 var item = eventArgs.get_item();
                var panel = $find("<%=RadXmlHttpPanel1.ClientID%>");
                     panel.set_value(item.ID);
                   
               }
           }
           </script>
           <div class="divContainer">
               <div class="divTreeView" style="">
                   <telerik:RadMenu ID="RadMenu1" runat="server" Width="200px" Skin="Office2007"  onclientitemclicked="onClicking" >
                   </telerik:RadMenu>
               </div>
               <div class="divXmlPanel">
                   <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"
                       Value="01" OnServiceRequest="XmlHttpPanel_ServiceRequest" Height="267px" Width="548px"
                       RenderMode="Block">
                       <telerik:RadGrid ID="RadGrid1" runat="server">
                       </telerik:RadGrid>
                   </telerik:RadXmlHttpPanel>
               </div>
           </div>
           <div style="height: 31px; background: url('Images/foot_back.png') no-repeat;">
           </div>
           <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Office2007">
           </telerik:RadAjaxLoadingPanel>
       </div>
       </form>

    C#
      private void BindMenu()
      {
          string sql = "";
          var dt = new DataTable();
          sql += " SELECT TOP (100) PERCENT PL_ID, Record_Title, Record_Parent, FROM database";
          dt = data.GetDataTable(sql);
          if (dt.Rows.Count > 0)
          {
              RadMenu1.DataSource = dt;
              RadMenu1.DataTextField = "Record_Title";
              RadMenu1.DataNavigateUrlField = "";
              RadMenu1.DataFieldID = "PL_ID";
              RadMenu1.DataFieldParentID = "Record_Parent";
              RadMenu1.DataBind();
          }
          else
          {
              RadGrid1.DataSource = null;
          }
     
    protected void XmlHttpPanel_ServiceRequest(object sender, RadXmlHttpPanelEventArgs e)
      {
          string dt = e.Value;
          BindGrid(dt);
      }
     
      private void BindGrid(string id)
      {
          string sql = "";
          var dt = new DataTable();
          sql += string.Format(" Select PL_ID, Record_Title, Record_Content, Record_Order_sort  From database where (PL_ID = {0})", id);
          dt = data.GetDataTable(sql);
          if (dt.Rows.Count > 0)
          {
              RadGrid1.DataSource = dt;
              //RadGrid1.CurrentPageIndex = 0;
              Session["NeedsRebind"] = true;
              RadGrid1.DataBind();
     
          }
          else
          {
              RadGrid1.DataSource = null;
          }
  2. Trent
    Trent avatar
    19 posts
    Member since:
    Apr 2009

    Posted 31 Mar 2011 Link to this post

    Funny how seemingly simple requested for assistance go un answered -- the forum must be the to hard basket
  3. Answer
    Kate
    Admin
    Kate avatar
    1898 posts

    Posted 05 Apr 2011 Link to this post

    Hello Trent,

    Please refer to the following help article: RadMenuItem object. As I see in the code that you have provided you use item.ID, however, we do not support such property. You can use item.get_value()  instead, as descrided in the above help article. 
    function onClicking(sender, eventArgs) {
                var item = eventArgs.get_item();
                var panel = $find("<%=RadXmlHttpPanel1.ClientID%>");
                panel.set_value(item.ID);
                    
               }
           }

    All the best,
    Kate
    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
Back to Top