To implement context menu in asp.net Gridview row , add this code on rowdatabound. Please copy this code and paste in code behind class:
Previously I was Explained about the How to remove rows from GridView using jQuery in asp.net, Nested GridView in ASP.NET Using c# with show/hide , How to Add a Locked Header Row to an ASP.NET GridView Control , How to remove rows from GridView using jQuery in asp.net
Protected Sub Grd_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Grd.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("oncontextmenu", "return ShowMenu(" + e.Row.RowIndex.ToString() + ")") RowIndex = e.Row.RowIndex End If End Sub
To popup the context menu, paste this code in header
<script language="javascript" type="text/javascript">
var Div = document.getElementById("DivContextMenu");
function HideMenu() {
Div.style.display = "none";
}
function ShowMenu(RowIndex) {
Div.style.display = "block";
return false;
}
<:/script>
Related posts
http://www.c-sharpcorner.com/Blogs/11128/
http://technico.qnownow.com/context-menu-on-right-click-in-asp-net-gridview-control/
http://aspalliance.com/946_Extended_GridView_Control.all
http://www.aspdotnet-suresh.com/2013/03/custom-jquery-right-click-menu-jquery.html
http://www.codeproject.com/Articles/21100/GridView-Hover-Menu
You can also use of hover menu
http://www.codeproject.com/Articles/21100/GridView-Hover-Menu
Comments
Post a Comment