I have a table Menu and the data is like the attached screen shot Database table
and I want output like below image,
Means all the null values or integer ==0 should be hidden.
Right now I am showing these 5 columns only as you can see in 2nd screen shot..
I have something like this..
List<Menu> lstMenus = obj.GetMenus(10);
My code is
var menus = new List< dynamic >();
foreach (Menu menuBE in lstMenus)
{
dynamic menu = new
{
menuBE.MenuID,
menuBE.ParentMenuID,
menuBE.LinkText,
menuBE.ScreenName,
menuBE.Parameters,
menuBE.URL
// if(menuBE.Parameters.Length>0 ){ Parameters = menuBE.Parameters,}
};
menus.Add(menu);
}
and I want to put some condition like the last commented line in foreach loop. If menuBE.Parameters.Length>0
then this Parameters column should add be in dynamic menu else not.
Any idea how it can be done?