Quantcast
Viewing all articles
Browse latest Browse all 25064

dynamic menu template items on SPMenu

Hi,

I have a custom webpart with SPGridview with SPMenuField. I want to hide or disable the menutemplates dynamically.

With referecne to one of the forum post  following method is used.

protected void projectGrid_RowDataBound(object sender, GridViewRowEventArgs e) 
        { 
            if (e.Row.RowType == DataControlRowType.DataRow) //the header Row is also considered for data bound 
            { 
                Guid projGuid = DataBinder.Eval(e.Row.DataItem, "PROJ_UID"); 
  
                Microsoft.SharePoint.WebControls.Menu ctrl = e.Row.Cells[2].Controls[0] as Microsoft.SharePoint.WebControls.Menu; 
                if (projGuid == null || projGuid == Guid.Empty) 
                {                                 
                   ctrl.HiddenMenuItems.Add(viewProject); 
                }                
            } 
        } 

Although the Menu.HiddenMenuItems.Add does not hide any menu item.

Is there something missing? or do I need to set the HiddenMenuFieldIds or any other properties?

Or can someone point to the good example of displaying dynamic manu items on SPMenuField will be a great help.

Thanks in Advance,

Rupali Kothawade


Rupali Kothawade


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>