I have created SPGridView and added one SPMenuField as the first column and some BoundFields. Then I added MenuTemplate to the first column. But there are rectangles with white color border (look at the picture). I want to hide them. How can I do it ?

SPGridView problem with visualization

Here is the code I use:

   SPMenuField colMenu = new SPMenuField();
   colMenu.HeaderText = "Title";
   colMenu.TextFields = "Title";
   colMenu.MenuTemplateId = "TitleListMenu";
   colMenu.NavigateUrlFields = "WebId, ListId, ID";
   colMenu.NavigateUrlFormat = "default.aspx?WebID={0}&ListID={1}&ListItemID={2}";
   colMenu.TokenNameAndValueFields = "Param1=ID";
   colMenu.SortExpression = "Title";

   MenuTemplate typeListMenu = new MenuTemplate();
   typeListMenu.ID = "TitleListMenu";

   // ... //


Use the build-in webdeveloper tool in the browser (F12) and inspect the element.
I'm pretty sure it's just border around the contextmenu div.

Add the below to your CSS file and brand it. Beware that this will change it for all contextmenus on your site using your CSS file, so you might want to narrow it down to your custom list.

Over all:

.s4-ctx{ }


#TitleListMenu .s4-ctx{ }
  • Yes, thank you. The build-in webdeveloper tool helped me to find this element. It has <td> tag. – andDaviD Jul 19 '12 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.