First the code gets an instance of the GridView using the
getElementById, then create a collection of all input controls in the GridView. Next it loops through each input control and checks the type (this is necessary because input controls include not only submit buttons but also things like textboxes). Finally we either enable or disable the submit button.
function DisableGridButtons()
{
var gridView = document.getElementById("gridview1");
var gridViewControls = gridView.getElementsByTagName("input");
for (i = 0; i < gridViewControls.length; i++)
{
// if this input type is button, disable
if (gridViewControls[i].type == "submit")
{
gridViewControls[i].disabled = true;
}
}
}
Tuesday, March 17, 2009
Enable/Disable All Buttons in a GridView using JavaScript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment