Disable AxToolbar when the grid is empty

By adding this code to the page it's possible to disable or hide the AxToolbar and add logic on menu items.


void Page_Init(object sender, EventArgs e)
{
// Setup event handler for toolbar connected via webpart connections
if (this.NameofAxToolbar != null)
this.NameofAxToolbar.SetMenuItemProperties +=
new EventHandler(webpart_SetToolbarMenuItemProperties);
}

protected void webpart_SetToolbarMenuItemProperties(object sender, SetMenuItemPropertiesEventArgs e)
{ if(EPProjTableList.GetDataSourceView(this.EPProjTableListGrid.DataMember).DataSetView.Count < 1)
{
e.MenuItem.Disabled= true;
}
}


Read more here

Comments

  1. Hi
    I thy this solution, bud didnot work property Disabled. Property Hidden work well.
    Any solution
    Frank

    ReplyDelete

Post a Comment

Popular posts from this blog

How to disable auto enabled flight key using KillSwitch

Technical intro to Feature management in D365FO

Continuous integration and deployment Power platform FinOps tweaking