This is a migrated thread and some comments may be shown as answers.
Pass ID from RadMenu to e.Value for use with XmlHttpPanel
2 Answers 23 Views
This is a migrated thread and some comments may be shown as answers.
Trent
Top achievements
Rank 2
Trent asked on 07 Dec 2010, 03:52 PM
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 Answers, 1 is accepted

Sort by
0
Trent
Top achievements
Rank 2
answered on 01 Apr 2011, 02:41 AM
Funny how seemingly simple requested for assistance go un answered -- the forum must be the to hard basket
0
Accepted
Kate
Telerik team
answered on 05 Apr 2011, 01:52 PM
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
Tags
Menu
Asked by
Trent
Top achievements
Rank 2
Answers by
Trent
Top achievements
Rank 2
Kate
Telerik team
Share this question
or