Skystone Software is an Echosoft Design Studio, dedicated to the rapid design and development of high-end enterprise application systems built within the Microsoft .NET framework. A software consultancy serving clients primarily in the Hartford, Connecticut area of the United States, Skystone provides rapid and affordable software development and project management.
|
|
Scott Waletzko, founder of Skystone Software, is a Windows and Web programmer and a Microsoft Most Valuable Professional (Visual Developer - Visual Basic) since 2006. Scott has extensive professional experience designing and developing software using C#, Visual Basic (both COM and .NET), HTML, JavaScript, and Flash / ActionScript. |
|
ImageButton + GridView + RowCommand = (Grid_RowCommand X 2)
Published: 5/12/2009 |
|
Some fun with Microsoft Math for a minute - tonight I ran into an undocumented "feature" of .NET 2.0 that is frustrating to say the least. If you use an ImageButton in a GridView to trigger a RowCommand event, it will fire the event twice. Fortunately, there's a way to test for the second, false trigger - just look for the image co-ordinates being passed along in the request:
C#
protected void gridData_RowCommand(object sender, GridViewCommandEventArgs e)
{
// undocumented bug with ImageButton - fires the command twice...
if (this.Request["x"] == null || this.Request["y"] == null) { return; }
// process real request etc...
}