• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 410
  • Last Modified:

Datagridview doesn't display context menu?

I have a simple test app with one form, one datagridview, and a
contextmenustrip.  I've assigned the menustrip to the datagridview and
given the grid one column.  There isn't any data in the grid.  I never
see the context menu appear when I right click the grid.  Any
suggestions?

Thanks,
Brett
0
brettr
Asked:
brettr
1 Solution
 
mattisflonesCommented:
A: You did something wrong..

Thats all the help you can get if you dont post code, or elaborate on the problem..
Ex: No data? Why? Was the GridView supposed to display data? How did you "assign" the menustrip to the GridView?


0
 
brettrAuthor Commented:
All of this is at design time.  There's no data because I'm just trying to get this to work in the simplest scenario.  It doesn't work in a more complex environment so I want to get at the smallest parts and work up from there.

I did all the assignments at design time so there isn't any code.  The datagridview and contextmenustrip were both dropped on a form.
0
 
sabeeshCommented:
You have to set DataGrid.contextmenu property

DataGrid.contextmenu  = contextmenu
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Gautham JanardhanCommented:
1) u got to have items in the contextmenu otherwise it wont popup
 2) u have to set the context menu property of data grid as ur context menu.

this should solve ur problem.
0
 
brettrAuthor Commented:
This is not a datagrid with a contextmenu.  It is a datagridview with a contextmenustrip.  The menu has menu items and I have assigned it to the grid's contextmenustrip.  No go.
0
 
brettrAuthor Commented:
Ok, my fault all the way around.  At design time, I need to add a
toolstripmenuitem to my contextmenustrip.  It looked like an item was
already there at design time in it's collection.  But once I clicked
Add (from clicking the collection property), I saw a child appear and
new that was my mistake.

The problem at run time is the datagridview will allow you to set
grid.contextmenu and fully intialize menu items.  However, I can't get
it to work at all.  This property isn't available at design
time...oddly.  But if you follow the above for contextmenustrip, it
also works at runtime.

Does any one know if a datagridview's context menu property actually
works, similar to a regular datagrid.contextmenu.

Thanks and sorry for the hassle.  I'm awarding points to the first person since every one else keeps referring to a datagrid.  Please "carefully" read the post before responding.

Brett
0
 
mattisflonesCommented:
:-)

Crap happends...

"Does any one know if a datagridview's context menu property actually
works, similar to a regular datagrid.contextmenu."

It should.. atleast thats what the documentation says!


0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now