Last post May 26, 2012 01:52 PM by amit.jain
May 25, 2012 08:38 PM|dwfreeman|LINK
The button controls include a property "CommandName". I know you can populate this property with certain built-in commands such as the page commands Next, Prev etc. How can I create my own custom commands to execute when the button is clicked? In this case
the button is located in a footer column of a gridview, so the button's click event is not directly available.
May 25, 2012 08:45 PM|markfitzme|LINK
You can put whatever you want in the commandname property. It will get used though with the Command event, not the Click. Also, if you have a button in a gridview, the grid's command event may take priority. Set the CommandName of your button, hit it, and
see if you see what comes through in the e.CommandName argument of the grid's Command event handler.
The rule of thumb is generally if the button's command event isn't getting fired off, check the containing control's command event such as a grid, datalist, etc.
May 26, 2012 10:10 AM|ramiramilu|LINK
OnCommand - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.command.aspx
May 26, 2012 12:09 PM|rakesh.sawant87|LINK
use gridview rowcommand event it will fire when any
button or a linkbutton is clicked
May 26, 2012 01:52 PM|amit.jain|LINK
you can write markup in gridview
<asp:ButtonField Text="Edit" CommandName="OpenPopUp"/>
and this in codebehind
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
if (e.CommandName == "OpenPopUp")
//Write you code here
refer http://www.csharpaspnetarticles.com/2012/04/edit-gridview-ajax-modalpopupextender.html for more info