Click here to Skip to main content
15,912,507 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi
I am open ribbon menu on gridview row mouse over
but I won't to open that on right click of gridview row .
how to do this....

I am using following code for this


C#
private void SetGridRows(GridView gv)
      {
          int iRowCount = 0;
          foreach (GridViewRow gr in gv.Rows)
          {
              Label lblName = (Label)gr.FindControl("WorkID");
              string id = lblName.Text;
              string sClass = "ListNorRow";
              if (iRowCount == 1)
              {
                  sClass = "ListAltRow";
              }
              gr.Attributes.Add("onmouseout", "javascript:this.className='" + sClass + "'");
              gr.Attributes.Add("onmouseover", "ShowPopup('" + id + "');javasscript:this.className='ListSelRow';");
              gr.Attributes.Add("OnClick", "HideContent('SubMenu');");
              iRowCount = iRowCount == 0 ? 1 : 0;
          }
      }
Posted
Comments
Dheeraj_Gupta 31-Jul-13 2:47am    
your question is very confusing.

1 solution

Refer - How can I capture the right-click event in JavaScript?[^].
Quote:
Use the oncontextmenu event.

Here's an example:
HTML
<div oncontextmenu="javascript:alert('success!');return false;">
    Lorem Ipsum
</div>

Don't forget to return false, otherwise the standard context menu will still pop up.

So, you can add the code in SetGridRows function for this event for each GridViewRow as you have done for onmouseout and onmouseover.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900