I recently had the requirement to provide multiple select-type commands on an ASP.NET GridView that each resulted in a different action. Using an
In your code-behind, you simply need to use an “If” or a “Switch” to determine which command to execute:
[csharp]protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
if(e.CommandName == “Select”)
else if(e.CommandName == “Email”)
else if(e.CommandName == “Print”)
That’s it. It’s rather simple and it helped me, so I wanted to share. Hopefully you find it useful.