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

Menu display problem

0 Answers 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pritam
Top achievements
Rank 1
Pritam asked on 29 Sep 2011, 08:07 AM
hi,

I have a when displaying menu Item for 3 rd child label..

RootItems are generated from Page_Load..
Code Snippet Below............
==================================================
SqlDataAdapter sda = new SqlDataAdapter("SELECT CAM_CGID,CAM_CNAM FROM E_CAT_MST WHERE CAM_CLVL=1", conn);
        DataTable dt = new DataTable();
        sda.Fill(dt);
        RadMenu1.DataSource = dt;
        RadMenu1.DataTextField = "CAM_CNAM";
        RadMenu1.DataValueField = "CAM_CGID";
         RadMenu1.DataBind();

===================================================
===============At the 2nd label the item  is loaded from Webservice====================
<Script>
 function itemPopulating(sender, eventArgs) {
        var item = eventArgs.get_item();
        var context = eventArgs.get_context();
        context["CAM_CPID"] = item.get_value();
             
    }
</Script>
==================================
===============Telerik Menu=======================
<telerik:RadMenu ID="RadMenu1" runat="server" 
            OnClientItemPopulating="itemPopulating" Flow="Vertical" Height="500" EnableRootItemScroll="true"
            DefaultGroupSettings-Height="300" EnableRoundedCorners="true" 
            EnableShadows="true">
             <WebServiceSettings Path="WebService2.asmx" Method="WebServiceMethodName" UseHttpGet="false"  />
    <LoadingStatusTemplate>
        <asp:Image runat="server" ID="LoadingImage" ImageUrl="~/ajax-loader.gif" ToolTip="Loading..."
            Width="15px" Height="15px" ImageAlign="Left"/>
    </LoadingStatusTemplate> 
=======================================================================
==============================Webservice Code==============================
 public RadMenuItemData[] WebServiceMethodName(RadMenuItemData item, object context)
    {
        DataTable productCategories = GetProductCategories(item.Value);
        List<RadMenuItemData> result = new List<RadMenuItemData>();
        foreach (DataRow row in productCategories.Rows)
        {
            RadMenuItemData itemData = new RadMenuItemData();
            itemData.Text = row["CAM_CNAM"].ToString();
            itemData.Value = row["CAM_CGID"].ToString();
        
                itemData.ExpandMode = MenuItemExpandMode.WebService;
                  result.Add(itemData);
        }
        return result.ToArray();
    }

   public DataTable GetProductCategories(string value)
    {
        DataTable dt = new DataTable();
        SqlDataAdapter sda = new SqlDataAdapter("SELECT CAM_CNAM,CAM_CGID  FROM E_CAT_MST WHERE  CAM_CLVL <> 1               AND CAM_CPID=" + value, conn);
        return dt;
    }
=========================================================================

Above is the total code snippet..It is working fine for 2nd label..But in 3rd Label menu item is collapsed..

Pls help....

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Pritam
Top achievements
Rank 1
Share this question
or