Posts

Showing posts with the label GridView

Context Menu in ASP.NET

Image
We normally face a task like to show Menu when we right click the gridview or treeview e.t.c. Many third party controls are providing this right click context Menu to the controls like one of the best third party control like Telerik . But we can do this type of requirements using jQuery also. To do this in ASP.NET we need to download the jQuery Context Menu plugin. We need frame the menu div based on our requirement.See this example to do < div >      < ul id ="myMenu" class ="contextMenu" >        < li class ="edit" >< a href ="#edit" > Edit Node </ a > </ li >        < li class ="delete" >< a href ="#delete" > Delete Node </ a > </ li >      </ ul >    </ div > * This source code was highlighted with Source Code Highlighter . After downloading the plugin you need to add this l...

Get the Clicked Cell Value and Column Name of GridView in ASP.NET

Image
Normally we find the requirement to get the selected Cell Clicked Value .In rare cases we need to find the Column Name and Index of the Cell clicked in the GridView. This is some how tricky work to get the Column name and index also.We can do this in many ways . We must be very much thankful to the jQuery contributors for such beautiful lightweight,fast and concise Library. Really this is very good  we can't iterate the table loop to the clicked cell value. With a Single we can get the clicked Value.Look at this line of Code $('#gv>tbody>tr>td').text(); For this requirement I have taken a grid which i have given a static datasource. protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AddData(); } } public void AddData() { try { DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(Int32)); dt.Col...